1.0

Table Of Contents
have at most single-hop access to data in the distributed system. (The SQLFire JDBC thin-client driver also
provides single-hop access to data for lightweight client applications.)
Note: If you use peer clients in a SQLFire distributed system that also contains data stores, keep in mind
that peer clients themselves cannot use disk stores or persist data. You must start data stores and locators
before starting peer clients, because peer clients rely on data stores to persist data. See Peer Client
Considerations for Persistent Data on page 76 for more information.
This code sample shows a more complete example of starting a peer client in a Java application:
try {
java.util.Properties p = new java.util.Properties();
// Use the locator running on the local host with port 3340 for peer member
discovery...
Connection conn =
DriverManager.getConnection("jdbc:sqlfire:;locators=localhost[3340];mcast-port=0;host-data=false");
// Alternatively, use multicast on port 33666 for peer member discovery...
/*
Connection conn =
DriverManager.getConnection("jdbc:sqlfire:;mcast-port=33666;host-data=false");
*/
// do something with the connection
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
Note:
Unlike Derby, SQLFire does not use a databaseName. Instead of a "database" the connection is to a
distributed system. The distributed system is uniquely identied by either the mcast-port or the
locators. See Conguration Properties on page 299.
The subprotocol in the URL sqlfire: ends with a colon (:) and the list of connection attributes starts
with a semicolon (;).
Setting mcast-port to 0 without specifying locators starts a "loner" (single member) distributed
system. See Conguration Properties on page 299.
The list of connection attributes is not parsed for correctness. If you pass an incorrect attribute, it is
simply ignored.
Setting the host-data attribute to true (default) species that data should be hosted in this member.
To avoid hosting data in a member, such as in a peer client, set host-date to false.
vFabric SQLFire User's Guide108
Developing Applications with SQLFire