ODBC and JDBC Guide

Table Of Contents
Chapter 6 | Using JDBC to share FileMaker data 31
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.1/mydataba
se”,”username”, “password”);
} catch(Exception e) {
System.out.println(e);
}
// get connection warnings
SQLWarning warning = null;
try {
warning = con.getWarnings();
if (warning == null) {
System.out.println("No warnings");
return;
}
while (warning != null) {
System.out.println("Warning: "+warning);
warning = warning.getNextWarning();
}
} catch (Exception e) {
Sysem.out.println(e);
}
}
Note This example is not meant to be compiled.
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.