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…
- Download the latest JDBC driver for Filemaker, currently at Software Update: FileMaker 11.3.76 xDBC Client Drivers
- 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.
- Download the test program’s source code here: FilemakerJDBCTest
- Edit the file to use the correct hostname or IP address for your FileMaker Server, as well as the database, user account, and password.
- In the Terminal or DOS prompt, cd to the directory containing the FilemakerJDBCTEst.java file.
- Type javac FilemakerJDBCTEst.java to compile the test program.
- 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.