Recipe for testing JDBC connection to FileMaker Server

FileMaker Server Advanced allows external systems to connect to its hosted database files via ODBC and JDBC. The remote systems can then run SQL commands against the hosted databases. Often the hard part is getting all the infrastructure ready for this. That includes the correct extended permissions on the FileMaker database file, needed drivers, firewall settings, etc.

FileMaker provides a test program you can use to check if a JDBC connection is working. It is a bit buried on their site, but can be found at: JDBC Test Application

 

However, it has come up several times that I needed to provide some working Java code that shows how to set up the connection. FileMaker has also provided us with a code fragment showing how this is done on page 31 of their ODBC and JDBC Guide. However, it doesn’t copy and paste cleanly, and it isn’t immediately obvious what needs to be changed to configure it for your system.

While I’m at it, we would really like a step-by-step list of what needs to be done to get this working. So here we go…

  1. Download the latest JDBC driver for Filemaker, currently at Software Update: FileMaker 11.3.76 xDBC Client Drivers
  2. For Mac OS X, it is recommended to copy the fmjdbc.jar file into the /Library/Java/Extensions folder. For Windows, there is no prescribed place for this, it just has to be somewhere in your Java classpath. See Wikipedia for more details on Java’s classpath, but simply putting it in the same directory as your Java should suffice.
  3. Download the test program’s source code here: FilemakerJDBCTest
  4. Edit the file to use the correct hostname or IP address for your FileMaker Server, as well as the database, user account, and password.
  5. In the Terminal or DOS prompt, cd to the directory containing the FilemakerJDBCTEst.java file.
  6. Type javac FilemakerJDBCTEst.java to compile the test program.
  7. Type java FilemakerJDBCTest to finally run the program.

If you’ve made it this far without problems, there’s a fair chance you should now see the No warnings message from the connection attempt.

Simon.

Leave a Reply