FileMaker 16 ® ODBC and JDBC Guide
© 2004–2017 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker, FileMaker Go, and the file folder logo are trademarks of FileMaker, Inc. registered in the U.S. and other countries. FileMaker WebDirect and FileMaker Cloud 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 dat
Contents Accessing a FileMaker database file from a macOS application Specifying ODBC client driver properties for a FileMaker DSN (macOS) Verifying access via ODBC (macOS) Chapter 5 Installing FileMaker JDBC client drivers Software requirements Networking requirements JDBC client driver installation Using the JDBC client driver Chapter 6 Using JDBC to share FileMaker data About JDBC Using the JDBC client driver About the JDBC client driver Using a JDBC URL to connect to your database Specifying driver p
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? 1 Use FileMaker software Product See 1. Interactively via the relationships graph 2.
Chapter 1 | Introduction 6 About ODBC and JDBC ODBC and JDBC are application programming interfaces (APIs). ODBC is an API for applications written in the C language, and JDBC is a similar API for the Java language. These APIs give client applications a common language for interacting with a variety of data sources and database services, including FileMaker Pro and FileMaker Server. All applications that support ODBC and JDBC recognize a basic subset of SQL (Structured Query Language) statements.
Chapter 1 | Introduction 7 Because FileMaker Pro generates the SQL statements used to communicate with an ODBC table that has been added to the relationships graph, you are limited to the specific Oracle, SQL Server, and MySQL data sources that FileMaker Pro supports in the relationships graph. Note You cannot modify the schema of external ODBC data sources using FileMaker Pro. Chapter 2, “Accessing external SQL data sources,” describes how to use FileMaker software as an ODBC client application.
Chapter 1 | Introduction 8 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. FileMaker Pro supports local access (same computer) only. Updating files from previous versions If you installed a driver from earlier versions of FileMaker Pro or FileMaker Server, you must install the driver for version 16.
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 5. Choose your data source, enter the user name and password (if any), and click OK to open the FileMaker Pro SQL Query builder dialog box. 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.
Chapter 2 | Accessing external SQL data sources 11 Working with ODBC tables in the relationships graph When you add an ODBC table to the relationships graph, you can connect to and work with data in external SQL data sources in much the same way that you work with data in the current, active FileMaker database file.
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 If you want to create a log file for long-running queries, select the Save long-running queries to a log file option, and enter the name for the log file. Click Finish to save your data source information. 8. Review the information about your FileMaker DSN. 1 Click Test to verify that you have correctly configured the ODBC client driver to access the FileMaker data source.
Chapter 3 | Installing FileMaker ODBC client drivers 16 Configuring client drivers (macOS) 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, which is a freeware product not supported by FileMaker.
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 If the connection is successful, you receive the message Test completed successfully. If the connection fails: 1 Make sure the FileMaker database file is hosted and available. 1 Update or correct your connection information. 1 Make sure your FileMaker account uses a privilege set with the fmxdbc extended privilege for access via ODBC/JDBC. 1 Verify that the FileMaker Server or FileMaker Pro host application has been set up for sharing via ODBC/JDBC.
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 on the FileMaker downloads and resources page.
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 macOS: 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 relationships 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 Example 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.1/myda tabase”,”username”, “password”); } catch(Exception e) { System.out.
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 getColumns getColumnPrivileges getMetaData 1 getTables 1 getTableTypes 1 getVersionColumns getTypeInfo Mapping
Chapter 7 | Reference information 30 String length is optional in table declarations. All strings are stored and retrieved in Unicode. Note FileMaker repeating fields are supported like arrays. Example INSERT INTO mytable(repField[3]) VALUES (‘this is rep 3’) SELECT repField[1], repField[2] FROM mytable Mapping FileMaker fields to JDBC data types The JDBC client driver uses the following mappings when converting FileMaker data types to JDBC SQL types.
Chapter 7 | Reference information 31 FileMaker ODBC error messages An error that occurs in the FileMaker Listener or data source includes the DSN, in the following format: [FileMaker] [FileMaker ODBC] message Example [FileMaker] [FileMaker ODBC] Invalid Username/Password If you get this type of error, you did something incorrectly with the database system. Check your FileMaker documentation for more information or consult your database administrator.
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 (macOS) 21 ODBC client driver (Windows) 20 drivers, compatible versions 8
Index 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 macOS creating a DSN 16 JDBC client driver requirements 22 verifying ODBC access 21 mapping data types JDBC client dri
Index T TCP/IP requirements 8 testing access JDBC client driver 28 ODBC client driver (macOS) 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 (macOS) 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 err