WAS v8.5 > Administer applications and their environment > Welcome to administering Data access resources > Administer data access applications > Configure a JDBC provider and data sourceConfigure client affinities for applications that use DB2 databases
The client affinities feature is an alternative to automatic client reroute when enabling your 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:
- You have a DB2 data source defined in the application server. See the topic, Configuring a data source using the dmgr console, for information about creating a data source.
- The DB2 data source to which the application connects is running one of the following databases:
- DB2 for z/OS Version 9.1 or later
- DB2 Database for Linux, UNIX, and Windows Version 9.5 or later
- You have implemented the DB2 database with a redundant setup or the ability to fail the DB2 server to a standby node.
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 WAS, the data source custom property, enableClientAffinitiesList, is used to enable client affinities. To use the dmgr 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...
- Configure a JDBC provider as usual with the JCC driver for DB2 in the class path.
- 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 your DB2 WLB environment.
- After the data source is created, navigate to its primary panel in the dmgr console by clicking Resources > JDBC > Data sources > data_source.
- Click WAS data source properties located under Additional Properties.
- Scroll down to the section DB2 automatic client reroute options.
- 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.
- Click OK, and save the changes.
- Navigate back to the data source primary panel, and click Custom properties located under Additional Properties.
- 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.
- Click OK and save the changes.
- Restart the application server.
Related
Configure a JDBC provider and data source
Configure a data source
Related information:
DB2 client considerations for the DB2 pureScale Feature
Client affinities for DB2 Database for Linux, UNIX, and Windows
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