DB2 Version 10.1 for Linux, UNIX, and Windows

Example of enabling DB2 for Linux, UNIX, and Windows automatic client reroute support in non-Java clients

You can fine-tune non-Java™ client setup for DB2® for Linux, UNIX, and Windows automatic client reroute (acr) support by setting values for several keywords in the db2dsdriver.cfg configuration file.

Note that if you do not define a list of alternate servers in the db2dsdriver.cfg configuration file, at the first successful connection to the server, the client obtains from the server a list of all available alternate servers. The client stores the list in memory and also creates a local cache file, srvrlst.xml that contains the server's list of alternate servers. This file is refreshed whenever a new connection is made and the server's list differs from the contents of the client srvrlst.xml file.

Suppose that database sample is a DB2 pureScale® instance with two members, at server db2luwa and port 446, and server db2luwb and port 446. The database has alternate server db2luwc and port 446 defined.

You want to fine-tune default automatic client reroute support by modifying these items:

Automatic client reroute characteristic db2dsdriver.cfg configuration keyword Desired value
Number of times to retry the connection to the alternate server maxAcrRetries 10
Number of seconds to wait between retries acrRetryInterval 5
Whether to try another server if the initial connection to the database fails enableAlternateServerListFirstConnect true
The host names and port numbers of the servers to try if the initial connection to the database fails <alternateserverlist>

Note that if you do not define a list of alternate servers in the db2dsdriver.cfg configuration file, at the first successful connection to the server, the client obtains from the server a list of all available alternate servers. The client stores the list in memory and also creates a local cache file, srvrlst.xml that contains the server's list of alternate servers. This file is refreshed whenever a new connection is made and the server's list differs from the contents of the client srvrlst.xml file. The srvrlst.xml file is located under CLIENT_CONFIG_DIR in the cfgcache directory.

Host names and port numbers:
  • db2luwa.luw.ibm.com, 446
  • db2luwb.luw.ibm.com, 446
  • db2luwc.luw.ibm.com, 446

Use the following db2dsdriver.cfg configuration file to implement these changes to automatic reroute behavior:

<configuration>
  <dsncollection>
    <dsn alias="sample" name="sample" host="db2luw.luw.ibm.com" port="446">
    </dsn>
  </dsncollection>
  <databases>
    <database name="sample" host="db2luw.luw.ibm.com" port="446">
      <acr>
        <parameter name="enableAcr" value="true">
        </parameter>
        <parameter name=
        <parameter name="maxAcrRetries" value="10">
        </parameter>
        <parameter name="acrRetryInterval" value="5">
        </parameter>
        <parameter name="enableAlternateServerListFirstConnect"
          value="true"></parameter>
        <alternateserverlist>
           <server name="server1" hostname="db2luwa.luw.ibm.com" port="446">
           </server>
           <server name="server2" hostname="db2luwb.luw.ibm.com" port="446">
           </server>
           <server name="server3" hostname="db2luwc.luw.ibm.com" port="446">
           </server>
        </alternateserverlist>
      </acr>
    </database>
  </databases>
</configuration>