Claris FileMaker ODBC and JDBC Guide
© 2004–2020 Claris International Inc. All rights reserved. Claris International Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker, FileMaker Cloud, FileMaker Go and the file folder logo are trademarks of Claris International Inc., registered in the U.S. and other countries. Claris, the Claris logo, Claris Connect, and FileMaker WebDirect are trademarks of Claris International Inc. All other trademarks are the property of their respective owners.
Contents Chapter 1 Introduction About this guide Where to find FileMaker product documentation Overview of ODBC and JDBC Using FileMaker software as an ODBC client application Importing ODBC data Adding ODBC tables to the relationships graph Using a FileMaker Pro 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
Contents Accessing a FileMaker Pro database file from a Windows application Specifying ODBC client driver properties for a FileMaker DSN (Windows) Verifying access via ODBC (Windows) Accessing a FileMaker Pro 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 access to FileMaker Cloud for AWS JDBC client driv
Chapter 1 Introduction This guide describes how you can use Claris™ FileMaker® software as an ODBC client application and as a data source for Open Database Connectivity (ODBC) and Java Database Connectivity (JDBC) applications. About this guide This guide assumes that you are familiar with the basics of using ODBC and JDBC, and constructing SQL queries. This guide provides the SQL statements and standards supported by the Claris FileMaker Platform. Refer to a third-party book on constructing SQL queries.
Chapter 1 | Introduction 6 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 1 Interactively via the 1 1 1 1 1 This guide, chapter 2 1 FileMaker Pro Help as an ODBC client application 1 Access ODBC data stored in an external SQL data source 1 Use a FileMaker database as a data source relationships graph 1 One-time, static via ODBC import or File menu > Open.
Chapter 1 | Introduction 7 1 add supplemental fields to ODBC tables to perform unstored calculations or to summarize data in the ODBC tables 1 add, change, and delete external data interactively 1 create relationships between fields in FileMaker tables and fields (also called “columns”) in ODBC tables 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
Chapter 1 | Introduction 8 Important If you disable ODBC/JDBC sharing after it has already been on, a data source hosted by FileMaker Server, or FileMaker Pro immediately becomes unavailable. The database administrator doesn’t have the capability to alert ODBC and JDBC client applications about the data source’s availability (the administrator can communicate only with FileMaker Pro database file clients).
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 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 Pro database file.
Chapter 3 Installing FileMaker ODBC client drivers To access a hosted FileMaker Pro 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 data 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 To install the ODBC client driver: 1. Do one of the following: 1 If you received your software electronically, double-click the installation icon (.exe file). 1 If you have an installation disk, insert the disk into the drive. 2. In the FileMaker Pro or FileMaker Server window, double-click the Extras folder. 3. Double-click the xDBC folder. 4. In the xDBC folder, double-click the ODBC Client Driver Installer folder. 5.
Chapter 3 | Installing FileMaker ODBC client drivers 14 To open the 32-bit ODBC administrator on a 64-bit Windows operating system: In Windows Control Panel, open Administrative Tools > ODBC Data Sources (32-bit). To open the 64-bit ODBC administrator on a 64-bit Windows operating system: In Windows Control Panel, open Administrative Tools > ODBC Data Sources (64-bit). Configuring the DSN (Windows) To configure the ODBC client driver: 1.
Chapter 3 | Installing FileMaker ODBC client drivers 15 To auto-detect language settings, select the Auto-detect language settings for application option. To specify the language setting, clear the Auto-detect language settings for application option and select the system setting you want to use. For the Multi-byte text encoding option, select System or select UTF-8.
Chapter 3 | Installing FileMaker ODBC client drivers 16 7. When the installation is complete, click Close. The ODBC client driver will be installed in this folder: /Library/ODBC Note You cannot change the installation folder for the ODBC client driver. The ODBC client driver, FileMaker ODBC, is now available for you to configure for accessing FileMaker data.
Chapter 3 | Installing FileMaker ODBC client drivers 17 Click Continue. Otherwise, click Finish to save your data source information. 8. For Database, select a database from the list of available databases, or type the filename of the FileMaker Pro database file you’re using as a data source. Note For database files hosted by FileMaker Server, the list of databases may be filtered based on the Filter Databases setting. See FileMaker Server Help.
Chapter 3 | Installing FileMaker ODBC client drivers 18 Where to go from here After you install and configure a client driver, you can construct and execute SQL queries to access FileMaker data. Client applications sometimes use different terminology for accessing a data source via ODBC. Many applications have menu items with names such as Get external data or SQL query. Review the documentation or Help that comes with your application for details. See chapter 4, “Using ODBC to share FileMaker data.
Chapter 4 Using ODBC to share FileMaker data Use the ODBC client driver to connect to FileMaker data from another application. The application that uses the ODBC client driver can directly access the data in a FileMaker Pro 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 20 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 21 5. Construct and execute an SQL query in the client application. Each FileMaker Pro database file that is open and set up for access is a separate data source (you create a DSN for each FileMaker Pro database file you want to access as a data source). Each database can have one or more tables. FileMaker Pro fields are represented as columns. The complete field name, including any non-alphanumeric characters, displays as the column name.
Chapter 4 | Using ODBC to share FileMaker data 22 Accessing a FileMaker Pro database file from a macOS application Specifying ODBC client driver properties for a FileMaker DSN (macOS) Create a DSN for each FileMaker Pro database file you want to access as a data source. The DSN identifies the FileMaker ODBC client driver, the location of the FileMaker host application, and the FileMaker Pro database file you’re accessing as a data source.
Chapter 5 Installing FileMaker JDBC client drivers To access a hosted FileMaker Pro 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 data 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 24 4. In the xDBC folder, double-click the JDBC Client Driver Installer folder. 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.
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 Pro 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 1 26 retrieving and updating the object referenced by a Ref object 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.
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 28 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 29 Example Connection conn = DriverManager.getConnection ( "jdbc:filemaker://192.168.1.1/customers?SocketTimeout=100", "admin", "admin" ); Solutions with multiple FileMaker Pro database files If your FileMaker Pro database solution uses many FileMaker Pro database files, create an additional database file that contains all the necessary external data source references, table occurrences, and relationships for your solution.
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 31 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 Pro 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 32 FileMaker ODBC error messages An error that occurs in the FileMaker XDBC Listener or data source includes the DSN, in the following format: [FileMaker] [FileMaker ODBC] message Example [FileMaker] [FileMaker ODBC] Invalid Account/Password If you get this type of error, you did something incorrectly with the database system. Check your FileMaker product 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 31 ODBC administrator (Windows) 14 A Access via ODBC/JDBC extended privilege 20 accounts and privileges 20 ARRAY data type 26 auto-generated keys 25 B BLOB 31 Boolean data type 26 C CAST function 30 catalog function 30 client application, using FileMaker Pro as 6 CLOB data type 26 column names 21 configuring a FileMaker data source for JDBC 28 for O
importing ODBC data 9 installation requirements 12, 23 J Java Development Kit (JDK) 26 Java version 23 JDBC client driver, described 25 described 25 error messages 32 JDBC client driver driver class and main entry point 26 mapping data types 31 registering with the JDBC driver manager 26 specifying the JDBC URL 26 verifying access 29 JDBC SPI 26 M macOS creating a DSN 16 JDBC client driver requirements 23 verifying ODBC access 22 mapping data types JDBC client driver 31 ODBC client driver 30 metadata
U URL (Uniform Resource Locator) for the JDBC client driver 26 using ODBC and JDBC with FileMaker software 6 V VARCHAR 31 verifying access JDBC client driver 29 ODBC client driver (macOS) 22 ODBC client driver (Windows) 21 W Windows creating a DSN 21 JDBC client driver requirements 23 verifying ODBC access 21 X XDBC Listener error messages 31 used with JDBC 26 used with ODBC 20