Java™ client setup for Sysplex workload balancing and automatic client reroute includes setting several IBM® Data Server Driver for JDBC and SQLJ properties.
The following examples demonstrate setting up Java client applications for Sysplex workload balancing and automatic client reroute for high availability.
The stored procedure name is used for classification only if the first statement that is issued by the client in the transaction is an SQL CALL statement.
For a complete list of classification attributes, see the information on classification attributes at Classification attributes (DB2 Performance).
This example assumes that you are using WebSphere® Application Server. The minimum level of WebSphere Application Server is Version 5.1.
Follow these steps to set up the client:
java com.ibm.db2.jcc.DB2Jcc -version
[jcc] Driver: IBM Data Server Driver for JDBC and SQLJ Architecture nnn xxx
Connection property | Recommended setting | Description |
---|---|---|
Reap Time | 0 | Specifies the interval, in seconds, between runs of the pool maintenance thread. The Reap Time interval affects performance. Because connections are not physical connections, disabling pool maintenance by setting this value to 0 is recommended. |
Aged Timeout | 0 | Specifies the interval in seconds before a physical connection is discarded. Setting Aged Timeout to 0 allows connections to remain in the pool indefinitely. |
Purge Policy | FailingConnectionOnly | Specifies how to purge connections when a stale connection or fatal connection error is detected. Because Sysplex workload balancing isolates WebSphere Application Server from stale connections or fatal connections errors, FailingConnectionOnly is the recommended setting. |
The Maximum Connections value does not need to be changed. Member Connections specifies the maximum number of physical connections that you create in your pool. It does not control the number of physical connections to a data sharing group. With Sysplex workload balancing, connections are logical, and use transports to associate a connection to a data sharing member. Physical connections are managed by transport pools in the driver. The maxTransportObjects property controls the maximum number of connections to the group.
Set the configuration properties in a DB2JccConfiguration.properties file by following these steps:
property=value
This example assumes that you are using the DriverManager interface to establish a connection.
Follow these steps to set up the client:
java com.ibm.db2.jcc.DB2Jcc -version
[jcc] Driver: IBM Data Server Driver for JDBC and SQLJ Architecture nnn xxx
java.util.Properties properties = new java.util.Properties();
properties.put("user", "xxxx");
properties.put("password", "yyyy");
properties.put("enableSysplexWLB", "true");
java.sql.Connection con =
java.sql.DriverManager.getConnection(url, properties);
property=value