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/mydatabase”,”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.