Developer’s Guide

Table Of Contents
Using Java and JDBC to deliver your data 9-5
To update a specific repeating field or field in a portal, add a period
and the number of the row to the end of the field name and enclose
the field name in double quotation marks. For example, to update the
third repetition of the Telephone field for a record in the
Employees.fp5 database, specify the following:
UPDATE “Employees.fp5” SET “Telephone.3”=’(555) 555-5555’ WHERE
recordid=4
To add a specific repeating field or field in a portal, add a period and
the number zero (0) to the end of the field name and enclose the field
name in double quotation marks. For example, to add the City field
to a portal in the Address relationship:
INSERT INTO “Employees.fp5” LAYOUT “Data Entry” (“Last Name”,
“Address::City.0”) VALUES (‘Jones’, ‘San Jose’)
Using DbOpen and DbClose pseudo procedures
The FileMaker JDBC Driver lets you open and close password-
protected FileMaker Pro databases that have remote administration
privileges and are located in the Web folder.
You only need to establish one connection to open or close your
databases. Use “Admin” as the user name and the password that you
specified in the Web Companion Configuration dialog box for
remote administration. Once the databases are open, you’ll need one
connection per unique database password to access the data.
Tip In order to minimize the number of connections, assign the same
database password for all your databases.
Here is an example for opening and closing a password-protected
database named “inventory.fp5,” where the remote administration
user name is “Admin,” the remote administration password (set in
the Web Companion Configuration dialog box) is “admin,” and the
database password is “inventory.”
import java.sql.*;
/**
public class FMPJDBCSecurity
{
public static void main(String[ ] args)
{
try
{
// register the FMPJDBC driver
Class.forName("com.fmi.jdbc.JdbcDriver");
// establish a connection to FileMaker Pro for remote
// administration purposes. The user name for remote
// administration is always "Admin."
Connection adminConnection =
DriverManager.getConnection("jdbc:fmpro:
http://localhost", "Admin", "admin");
// create a statement for opening the "inventory.fp5"
// database. Since the "inventory.fp5" database is
// password protected, you also need to specify the
// password in the call to the dbopen procedure.
CallableStatement openDbStatement =
adminConnection.prepareCall("{call
dbopen(\"inventory.fp5\", \"inventory\")}");
openDbStatement.execute();
// establish a connection to FileMaker Pro for
// retrieving data from the "inventory.fp5" database.
// The "inventory.fp5" database uses FileMaker Pro
// security, so you don’t need to provide a user name.
// A user name is only necessary for remote
// administration or if the databases is protected via
// the Web Security Database.
Connection inventoryConnection =
DriverManager.getConnection("jdbc:fmpro:
http://localhost", null, "inventory");
Statement inventoryStatement =
inventoryConnection.createStatement();
ResultSet inventoryData =