FileMaker 15 ® ODBC and JDBC Guide
© 2004–2016 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and FileMaker Go are trademarks of FileMaker, Inc. registered in the U.S. and other countries. The file folder logo and FileMaker WebDirect are trademarks of FileMaker, Inc. All other trademarks are the property of their respective owners. FileMaker documentation is copyrighted.
Contents Chapter 1 Introduction About this guide Where to find FileMaker documentation About ODBC and JDBC Using FileMaker software as an ODBC client application Importing ODBC data Adding ODBC tables to the relationships graph Using a FileMaker database as a data source Accessing a hosted FileMaker Pro database Limitations with third-party tools Networking requirements Updating files from previous versions Chapter 2 Accessing external SQL data sources Importing ODBC data Executing SQL to interact with d
Chapter 4 Using ODBC to share FileMaker data About ODBC Using the ODBC client driver Overview of accessing a FileMaker database file Accessing a FileMaker database file from a Windows application Specifying ODBC client driver properties for a FileMaker DSN (Windows) Verifying access via ODBC (Windows) Accessing a FileMaker database file from an OS X application Specifying ODBC client driver properties for a FileMaker DSN (OS X) Verifying access via ODBC (OS X) Chapter 5 Installing FileMaker JDBC clien
Chapter 1 Introduction This guide describes how you can use FileMaker® software as an ODBC client application and as a data source for Open Database Connectivity (ODBC) and Java Database Connectivity (JDBC) applications. The following table gives an overview of how to use ODBC and JDBC with FileMaker software. What do you want to do? How do you do it? Product See 1 Use FileMaker software as an 1. Interactively via the relationships graph 2. One-time, static via ODBC import or File menu > Open.
Chapter 1 | Introduction 6 Using ODBC or JDBC APIs, a client application communicates with a driver manager that identifies the client driver to communicate with a data source. Client Application Driver Manager Client Driver Data Source FileMaker software can act either as a client application or as a data source. Using FileMaker software as an ODBC client application As an ODBC client application, FileMaker software can access data in external SQL data sources.
Chapter 1 | Introduction 7 Using a FileMaker database as a data source As a data source, FileMaker data is shared with ODBC- and JDBC-compliant applications. The application connects to the FileMaker data source using the FileMaker client driver, constructs and executes the SQL queries using ODBC or JDBC, and processes the data retrieved from the FileMaker database solution.
Chapter 1 | Introduction 8 Limitations with third-party tools Microsoft Access: When using Microsoft Access to view data in a FileMaker data source, do not use data from a summary field. The summary field’s data should not be edited in Microsoft Access, and the data value that is displayed in Microsoft Access may not be accurate. Networking requirements You need a TCP/IP network when using FileMaker Server to host a FileMaker database file as a data source over a network.
Chapter 2 Accessing external SQL data sources As an ODBC client application, FileMaker software can access data in external SQL data sources. FileMaker software connects to the external SQL data source using the client driver for the ODBC data source, and either imports ODBC data or works with ODBC tables in the relationships graph. Whether you are importing ODBC data or working with ODBC tables in the relationships graph, you must configure a driver for the ODBC data source you’re using.
Chapter 2 | Accessing external SQL data sources 10 6. Using the FileMaker Pro SQL Query builder dialog box, you can construct a query. Select the table from which you want to import, and then select specific columns you want to use in your SQL query. Use the WHERE tab to construct search criteria and the ORDER BY tab to specify a sort order. You can also type an SQL statement directly into the SQL Query builder dialog box.
Chapter 2 | Accessing external SQL data sources 11 Data sources supported in FileMaker 15 As an ODBC client application, FileMaker supports external SQL data sources such as Oracle, Microsoft SQL Server, and MySQL Community Edition as ODBC tables in the relationships graph. For information about the supported external SQL data sources, search the FileMaker Knowledge Base available at http://help.filemaker.com.
Chapter 3 Installing FileMaker ODBC client drivers To access a hosted FileMaker database file as an ODBC data source, you need to install the ODBC client driver. These instructions help you install the ODBC client driver needed to access FileMaker as a data source from third-party and custom applications via ODBC. Install the client driver on the machine where the third-party application is installed.
Chapter 3 | Installing FileMaker ODBC client drivers 13 3. Double-click the xDBC folder. 4. In the xDBC folder, double-click the ODBC Client Driver Installer folder. 5. In the ODBC Client Driver Installer folder, double-click the installer file for the driver you want to install. 1 To install the 32-bit client driver (fmodbc32.dll), use the 32-bit installer file: FMODBC_Installer_Win32.msi 1 To install the 64-bit client driver (fmodbc64.dll), use the 64-bit installer file: FMODBC_Installer_Win64.msi 6.
Chapter 3 | Installing FileMaker ODBC client drivers 14 Configuring the DSN (Windows) To configure the ODBC client driver: 1. In the ODBC Data Source Administrator, select the System DSN or User DSN tab. You create a DSN for each FileMaker database file you want to access as a data source. 2. Click Add. 3. Select FileMaker ODBC, and click Finish. 4. Click Next. 5. For Name, enter a name that will be meaningful to others accessing the FileMaker data source.
Chapter 3 | Installing FileMaker ODBC client drivers 15 1 Select the Describe text fields as long varchar option to correct issues with long field values, such as fields that do not have a maximum length specified getting used for Microsoft Word Mail Merge import, or field values in PHP applications that are longer than 255 characters. If you do not use this option for field values longer than 255 characters, then your application may retrieve an empty string (Windows) or only 255 characters (OS X).
Chapter 3 | Installing FileMaker ODBC client drivers 16 Configuring client drivers (OS X) Before using an ODBC client application to access a FileMaker data source, you must configure a client driver for the data source. Configuration settings identify the client driver you’re using, the location of the data source, and details on how you intend to connect. These instructions assume you have installed the ODBC Manager from Actual Technologies, available at http://www.odbcmanager.
Chapter 3 | Installing FileMaker ODBC client drivers 17 If you want the SQL_C_CHAR text type to be interpreted by the driver as the SQL_C_WCHAR text type, select the Treat text types as Unicode option. For the Multi-byte text encoding option, select System (MacRoman) or select UTF-8. For example, some applications such as Microsoft Excel may expect text to be encoded using the System encoding, but web applications may expect text to be encoded using UTF-8 encoding.
Chapter 4 Using ODBC to share FileMaker data Use the ODBC client driver to connect to a FileMaker data source from another application. The application that uses the ODBC client driver can directly access the data in a FileMaker database file. The FileMaker ODBC client driver is FileMaker ODBC. Note You can also use FileMaker Pro as an ODBC client application, interacting with records from another data source via ODBC using SQL.
Chapter 4 | Using ODBC to share FileMaker data 19 Using the ODBC client driver The ODBC client driver supports ODBC 3.0 Level 1. You can use the ODBC client driver with any ODBC-compliant application.
Chapter 4 | Using ODBC to share FileMaker data 20 3. Make sure the FileMaker database file you want to access is hosted and available. If your FileMaker database solution uses more than one FileMaker database file, all of the database files must be on the same computer. 4. Connect to the FileMaker data source. 5. Construct and execute an SQL query in the client application.
Chapter 4 | Using ODBC to share FileMaker data 21 1 Make sure your FileMaker account uses a privilege set with the extended privilege of Access via ODBC/JDBC. 1 Verify that the FileMaker Server or FileMaker Pro host application has been set up for sharing via ODBC/JDBC. Accessing a FileMaker database file from an OS X application Specifying ODBC client driver properties for a FileMaker DSN (OS X) Create a DSN for each FileMaker database file you want to access as a data source.
Chapter 5 Installing FileMaker JDBC client drivers To access a hosted FileMaker database file as a JDBC data source, you need to install the JDBC client driver. These instructions help you install the client driver needed to access FileMaker as a data source from third-party and custom applications via JDBC. Install the client driver on the machine where the third-party application is installed. Check for updates to the client drivers at this URL: http://www.filemaker.
Chapter 5 | Installing FileMaker JDBC client drivers 23 5. Copy the fmjdbc.jar file to the appropriate folder for your operating system: 1 Windows: Copy the fmjdbc.jar file to the folder that includes your Java executable file (java.exe) or to another folder location included in the ClassPath of your Java application. 1 OS X: Copy the fmjdbc.jar file to the /Library/Java/Extensions folder or to another folder location included in the ClassPath of your Java application.
Chapter 6 Using JDBC to share FileMaker data If you’re a Java programmer, you can use the JDBC client driver with any Rapid Application Development (RAD) tool to visually create a Java application or applet that connects to a FileMaker data source. The Java application or applet that uses the JDBC client driver can directly access the data in a FileMaker database file. About JDBC JDBC is a Java API for executing SQL statements, the standard language for accessing relational databases.
Chapter 6 | Using JDBC to share FileMaker data 1 1 1 1 1 25 Updating of columns containing CLOB, ARRAY, and REF data types Boolean data type DATALINK data type Transform groups and type mapping Relationship between the JDBC SPI and the Connector architecture The JDBC client driver has been tested against the Java Development Kit (JDK) 1.6, 1.7, and 1.8. It is a Type 4 driver — a native protocol, pure Java driver that converts JDBC calls directly into the network protocol used by FileMaker.
Chapter 6 | Using JDBC to share FileMaker data 26 3. Returns error codes. import java.sql.*; class FMPJDBCTest { public static void main(String[ ] args) { // register the JDBC client driver try { Driver d = (Driver)Class.forName("com.filemaker.jdbc.Driver").newInstance(); } catch(Exception e) { System.out.println(e); } // establish a connection to FileMaker Connection con; try { con = DriverManager.getConnection(“jdbc:filemaker://192.168.1.
Chapter 6 | Using JDBC to share FileMaker data 27 Specifying driver properties in the URL subname Specify the user and password driver properties in the subname of the JDBC URL. These are the properties that could be passed to the connection when calling the DriverManager.getConnection method via the Properties parameter.
Chapter 6 | Using JDBC to share FileMaker data 28 Verifying access via JDBC Note The sample file FMServer_Sample cannot be used to test JDBC connections. To test JDBC connections, upload your own database.
Chapter 7 Reference information ODBC Catalog functions The ODBC client driver supports the following Catalog functions: 1 1 1 1 1 SQLTables - catalog information is stored and reported as single part names (table name only) SQLColumns SQLColumnPrivileges SQLDescribeCol SQLGetTypeInfo JDBC DatabaseMetaData methods The JDBC client driver supports the following DatabaseMetaData methods: 1 1 1 1 1 1 1 getColumns getColumnPrivileges getMetaData getTypeInfo getTables getTableTypes getVersionColumns Mappin
Chapter 7 | Reference information 30 FileMaker field type Converts to ODBC data type About the data type container (BLOB) SQL_LONGVARBINARY You can retrieve binary data, file reference information, or data of a specific file type from a container field. Within a SELECT statement, use the CAST() function to retrieve file reference information, and use the GetAs() function to retrieve data of a specific file type. The result is mapped to the corresponding ODBC data type.
Chapter 7 | Reference information 31 ODBC and JDBC error messages Here are the basic formats of error messages you receive when working with FileMaker and ODBC/JDBC.
Index Numerics 32-bit architecture 12 client driver (Windows) 13 ODBC administrator (Windows) 13 64-bit architecture 12 client driver (Windows) 13 data types 30 ODBC administrator (Windows) 13 A Access via ODBC/JDBC extended privilege 19 accounts and privileges 19 ARRAY data type 25 auto-generated keys 24 disabling a shared FileMaker database file 7 documentation 5 DOUBLE 30 driver properties JDBC client driver 27 ODBC client driver (OS X) 21 ODBC client driver (Windows) 20 drivers, compatible versions 8
I Import Records script step 9, 10 importing ODBC data 9 installation requirements 12, 22 J Java Development Kit (JDK) 25 Java version 22 JDBC client driver, described 24 described 24 error messages 31 JDBC client driver driver class and main entry point 25 mapping data types 30 registering with the JDBC driver manager 25 specifying the JDBC URL 25 verifying access 28 JDBC SPI 25 M mapping data types JDBC client driver 30 ODBC client driver 29 metadata methods 29 Microsoft Access 8 MySQL 11 N network
T TCP/IP requirements 8 testing access JDBC client driver 28 ODBC client driver (OS X) 21 ODBC client driver (Windows) 20 TIME 30 TIMESTAMP 30 U URL (Uniform Resource Locator) for the JDBC client driver 25 using ODBC and JDBC with FileMaker 5 V VARCHAR 30 verifying access JDBC client driver 28 ODBC client driver (OS X) 21 ODBC client driver (Windows) 20 W websites, FileMaker support pages 5 Windows creating a DSN 20 JDBC client driver requirements 22 verifying ODBC access 20 X XDBC Listener error me