FileMaker 13 ® ODBC and JDBC Guide
© 2004–2013 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and Bento are trademarks of FileMaker, Inc. registered in the U.S. and other countries. The file folder logo, FileMaker WebDirect, and the Bento logo 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 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 Installing current drivers Chapter 2 Accessing external SQL data sources Importing ODBC data Executing SQL to interact with data sources v
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) Changing an existing ODBC client driver (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) Changing an existing ODBC c
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 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 When you use FileMaker Pro or FileMaker Server as the host for a solution that includes ODBC tables in the relationships graph, you configure the ODBC client driver for the external SQL data source on the host machine.
Chapter 3 Installing FileMaker ODBC client drivers 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. The ODBC client driver is available through a separate installation on your FileMaker installation disk or electronic download in the xDBC folder. Check for updates to the client drivers at this URL: http://www.filemaker.
Chapter 3 | Installing FileMaker ODBC client drivers 13 ODBC client driver installation (Windows) Windows 32-bit and 64-bit client drivers are installed as separate libraries. On a 32-bit Windows operating system, you can install the 32-bit client driver only. On a 64-bit Windows operating system, both the 32-bit and 64-bit client drivers can be installed. To install the ODBC client driver: 1. Do one of the following: 1 If you received your software electronically, double-click the installation icon (.
Chapter 3 | Installing FileMaker ODBC client drivers 14 Opening the ODBC administrator (Windows) To configure the 32-bit client driver, you must use the 32-bit ODBC administrator. To configure the 64-bit client driver, you must use the 64-bit ODBC administrator. To open the 32-bit ODBC administrator on a 32-bit Windows operating system: In the Windows Control Panel, open Administrative Tools > Data Sources (ODBC). Note Administrative Tools appear in the System and Security category.
Chapter 3 | Installing FileMaker ODBC client drivers 15 6. For Host: 1 If you’re connecting to a database file hosted by FileMaker Pro on your local machine, enter localhost or the IP address 127.0.0.1. 1 If you’re connecting to a database file hosted by FileMaker Server over a network, enter the IP address of the FileMaker Server. If you have enabled sharing via ODBC/JDBC in the host application, you can select Connect to host to obtain the names of available databases. Click Next.
Chapter 3 | Installing FileMaker ODBC client drivers 16 ODBC client driver installation (OS X) OS X 32-bit and 64-bit client drivers are installed as a single bundle (FileMaker ODBC.bundle) in the /Library/ODBC folder. The ODBC client application loads the correct driver automatically. To install the ODBC client driver: 1. Do one of the following: 1 If you received your software electronically, double-click the disk image icon (.dmg file).
Chapter 3 | Installing FileMaker ODBC client drivers 17 4. Click Continue. 5. For Name, enter a name that will be meaningful to others accessing the FileMaker data source. For Description, enter an optional description of the FileMaker data source. Click Continue. 6. For Host: 1 If you’re connecting to a database file hosted by FileMaker Pro on your local machine, enter localhost or the IP address 127.0.0.1.
Chapter 3 | Installing FileMaker ODBC client drivers 18 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. If you receive an error message, you can correct the connection information.
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 20 Using the ODBC client driver You can use the ODBC client driver with any ODBC-compliant application. Sharing your FileMaker database file as a data source, you can: 1 1 1 1 perform mail merges with Microsoft Word. create charts with Microsoft Excel. move FileMaker data to a DBMS like Microsoft SQL Server. further analyze your FileMaker data with query or reporting tools to create charts, construct adhoc queries, and perform drill-down analysis.
Chapter 4 | Using ODBC to share FileMaker data 21 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 22 To change the existing ODBC client driver: 1. In the ODBC Data Source Administrator, select the System DSN or User DSN tab (select the tab used when you previously configured). 2. Choose the FileMaker data source that you previously configured. The data source name you originally entered appears under Name, and FileMaker ODBC appears as the Driver. 3. Click Configure. The FileMaker DSN Configuration dialog box appears. 4.
Chapter 4 | Using ODBC to share FileMaker data 23 Verifying access via ODBC (Windows) To verify that you’ve correctly configured the ODBC client driver to access the FileMaker data source: 1. In the Windows Control Panel, open Administrative Tools > Data Sources (ODBC). Note Administrative Tools appear in the System and Security category. The ODBC Data Source Administrator opens. 2. Select the System DSN or User DSN tab (select the tab used when you previously configured). 3.
Chapter 4 | Using ODBC to share FileMaker data 24 To change an existing ODBC client driver: 1. Launch the ODBC Manager utility. (The ODBC Manager is installed in the Utilities folder in the Applications folder.) 2. Click the System DSN or User DSN tab. 3. Choose the FileMaker data source that you previously configured. The data source name you originally entered appears under Name, and FileMaker ODBC appears as the Driver. 4. Click Configure. The FileMaker DSN Configuration dialog box opens. 5.
Chapter 4 | Using ODBC to share FileMaker data 25 1 For the Multi-byte text encoding option, select System 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. If the application expects a specific encoding but this option specifies a different encoding, then the application may display some characters incorrectly.
Chapter 5 Installing FileMaker JDBC client drivers These instructions help you install the client driver needed to access FileMaker as a data source from third-party and custom applications via JDBC. The client driver is available on your FileMaker DVD or electronic download in the xDBC folder. Check for updates to the client drivers at this URL: http://www.filemaker.
Chapter 5 | Installing FileMaker JDBC client drivers 27 Using the JDBC client driver Your Java application or applet must register the JDBC client driver with the JDBC driver manager, and you must specify the correct JDBC URL from within the application or applet. Important You must reserve the port 2399 for the FileMaker JDBC client driver. The port number is always 2399. You cannot change the JDBC sharing to a different port.
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 29 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 and 1.7. 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 30 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 31 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 32 Verifying access via JDBC When verifying access to a FileMaker database file via JDBC, make sure: 1 the FileMaker database file is hosted and available. 1 your FileMaker account uses a privilege set with the extended privilege of Access via ODBC/JDBC. 1 The FileMaker Server or FileMaker Pro host application has been set up for sharing via ODBC/JDBC.
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).
Chapter 7 | Reference Information 34 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. calculation The result is mapped to the corresponding ODBC data type.
Chapter 7 | Reference Information 35 ODBC and JDBC error messages Here are the basic formats of error messages you receive when working with FileMaker and ODBC/JDBC.
Index A E Access via ODBC/JDBC extended privilege 20 accounts and privileges 20 ARRAY data type 29 auto-generated keys 28 error message formats 35 Execute SQL script step 10 ExecuteSQL function 10 extended privileges 20 B F Boolean data type 29 fields mapping to JDBC 34 mapping to ODBC 33 FileMaker products 7 files organizing on one computer 7 setting up access to 20 C CAST function 34 client application, using FileMaker as 5 CLOB data type 29 column names 21 configuring a FileMaker data source via
N U network requirements 8 null value 33 URL (Uniform Resource Locator) for the JDBC client driver 29 using ODBC and JDBC with FileMaker 5 O V ODBC described 19 error messages 35 repeating fields 34 ODBC Administrator (OS X) 25 ODBC catalog functions 33 ODBC client driver mapping data types 33 verifying access (OS X) 25 verifying access (Windows) 23 ODBC Data Source Administrator (Windows) 24 OS X creating a DSN 23 JDBC client driver requirements 26 ODBC client driver requirements 12 verifying ODB