Example of enabling Db2 on Linux, UNIX, and Windows systems workload balancing support in Java applications

Java™ client setup for Db2 on Linux, UNIX, and Windows systems workload balancing support includes setting several IBM® Data Server Driver for JDBC and SQLJ properties.

The following example demonstrates setting up Java client applications for Db2 on Linux, UNIX, and Windows systems workload balancing support.

Before you can set up the client, the servers to which the client connects must be configured in a Db2 pureScale® instance.

Follow these steps to set up the client:

  1. Verify that the IBM Data Server Driver for JDBC and SQLJ is at the correct level to support workload balancing by following these steps:
    1. Issue the following command in a command line window:
      java com.ibm.db2.jcc.DB2Jcc -version
    2. Find a line in the output like this, and check that nnn is 3.58 or later.
    3. [jcc] Driver: IBM Data Server Driver for JDBC and SQLJ Architecture nnn xxx
  2. Set IBM Data Server Driver for JDBC and SQLJ properties to enable the connection concentrator or workload balancing:
    1. Set these Connection or DataSource properties. Alternatively, you can set their equivalent global configuration properties.
      • enableSysplexWLB
      • maxTransportObjects
    2. Set the db2.jcc.maxRefreshInterval global configuration property in a DB2JccConfiguration.properties file to set the maximum refresh interval for all DataSource or Connection instances that are created under the driver.

    Start with settings similar to these:

    Table 1. Example of property settings for workload balancing for Db2 on Linux, UNIX, and Windows systems
    Property Setting
    enableSysplexWLB true
    maxTransportObjects 80
    db2.jcc.maxRefreshInterval 10

    The values that are specified are not intended to be recommended values. You need to determine values based on factors such as the number of physical connections that are available. The number of transport objects must be equal to or greater than the number of connection objects.

  3. To fine-tune workload balancing for all DataSource or Connection instances that are created under the driver, set the db2.jcc.maxTransportObjects configuration property in a DB2JccConfiguration.properties file.
    Start with a setting similar to this one:
    db2.jcc.maxTransportObjects=1000
    
  4. Optional: Specify alternate server names in the clientRerouteAlternateServername and clientRerouteAlternatePortNumber properties. This step is not necessary for enabling workload balancing. However, specifying an alternate server list is useful to ensure that the first connection is successful if the primary server is unavailable.