1.1

Table Of Contents
Chapter 18
Developing Java Clients and Peers
A Java application can use the JDBC thin client driver to connect to a SQLFire cluster and execute SQL statements.
Or, a Java application can use the JDBC peer client driver to embed a SQLFire peer process and participate as a member
of the cluster.
Both drivers use the basic JDBC connection URL of jdbc:sqlfire: where:
jdbc: is the protocol.
sqlfire: is the subprotocol.
Connect to a SQLFire Server with the Thin Client JDBC Driver
The thin client driver class is packaged in com.vmware.sqlre.jdbc.ClientDriver. In addition to the basic JDBC
Connection URL, you specify the host and port number of a SQLFire server or a locator to which the thin client
driver will connect.
For example:
jdbc:sqlfire://myHostName:1527/
Code Example on page 113
Thin Client Failover on page 114
Enabling Single-Hop Data Access on page 114
Conguring TCP Keepalive Settings on page 115
Thin Client Driver Limitations on page 115
Code Example
This code sample shows a more complete example of connecting to a SQLFire server in a Java application:
try {
java.util.Properties p = new java.util.Properties();
// 1527 is the default port that a SQLFire server uses to listen
for thin client connections
Connection conn =
DriverManager.getConnection("jdbc:sqlfire://myHostName:1527/");
// do something with the connection
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
113