+

Search Tips   |   Advanced Search

Configure client affinities for applications that use DB2 databases

The client affinities feature is an alternative to automatic client reroute when enabling the data source to use other servers when a connection fails. In this client-only method, the client determines the order that alternate servers run during failover. For more information about client affinities, see the topic, Client affinities for DB2 Database for Linux, UNIX, and Windows, in the DB2 information center.

This task assumes that:

In WebSphere Application Server, client affinities allows the DB2 data source on the client or application server to control the order of servers that are tried during initial connection processing.

For WebSphere Application Server, the data source custom property, enableClientAffinitiesList, is used to enable client affinities. To use the console to configure client affinities, use the DB2 automatic client reroute options section of the WAS data source properties panel to configure the following properties: Alternate server names, Alternate port numbers, Retry interval for client reroute, and Maximum retries for client reroute. We can also use the Custom properties panel to configure other client affinities properties as needed, including enableSeamlessFailover and affinityFailbackInterval.

The data source custom property, enableClientAffinitiesList, changes the semantics of the clientRerouteAlternateServerName and clientRerouteAlternatePortNumber properties.

To learn more about these properties, see the DB2 information center topic, Configuration of client affinities for Java clients for DB2 Database for Linux, UNIX, and Windows connections.

To configure client affinities in the application server...

  1. Configure a JDBC provider as usual with the JCC driver for DB2 in the class path.

  2. Create a data source that uses the JDBC provider that was created in step 1. The server name and port information must be the name of the preferred primary server from the DB2 WLB environment.

  3. After the data source is created, navigate to its primary panel in the console by clicking Resources > JDBC > Data sources > data_source.

  4. Click WebSphere Application Server data source properties located under Additional Properties.

  5. Scroll down to the section DB2 automatic client reroute options.

  6. In the DB2 automatic client reroute options section, configure the Alternate server names, Alternate port numbers, Retry interval for client reroute, and Maximum retries for client reroute.

  7. Click OK, and save the changes.

  8. Navigate back to the data source primary panel, and click Custom properties located under Additional Properties.

  9. On the Custom properties panel, configure other client affinities properties as needed, including enableClientAffinitiesList, enableSeamlessFailover and affinityFailbackInterval. Read about the configuration of client affinities for Java clients for DB2 Database for Linux, UNIX, and Windows connections, in the DB2 information center, for the recommended values for these properties.

  10. Click OK and save the changes.

  11. Restart the application server.


Related tasks

  • Configure a JDBC provider and data source
  • Configure a data source using the administrative console


    Related information:

    DB2 client considerations for the DB2 pureScale Feature
    Client affinities for DB2 Database for Linux, UNIX, and Windows
    Configuration of client affinities for Java clients for DB2 Database for Linux, UNIX, and Windows connections
    Java client support for high availability on IBM data servers
    Common IBM Data Server Driver for JDBC and SQLJ properties for all supported database products
    IBM DB2 Driver for JDBC and SQLJ client reroute support
    IBM WebSphere Developer Technical Journal: Building a high availability database environment using WebSphere middleware, Part 1