DB2 Version 9.7 for Linux, UNIX, and Windows

Use of the db2dsdriver.cfg configuration file by embedded SQL applications

Embedded SQL applications support use of the db2dsdriver.cfg configuration file for high availability solutions with supported servers.

You can use the db2dsdriver.cfg configuration file for work load balancing (WLB) and automatic client reroute (ACR) with supported servers. The WLB and ACR associated keywords are available for use with the embedded applications.

Table 1. Settings to control workload balancing behavior
Element in the db2dsdriver.cfg configuration file Section Value
connectionLevelLoadBalancing parameter <database> Must be set to true if you want to use transaction-level workload balancing. The value is true by default. However, the default is false if the server accessed is DB2® for z/OS® .
enableWLB parameter <wlb> Specifies whether transaction-level workload balancing is in effect. The value is false by default.
maxTransportIdleTime <wlb> Specifies the maximum elapsed time in number of seconds before an idle transport is dropped. The default is 60 seconds. The minimum supported value is 0.
maxTransportWaitTime <wlb> Specifies the number of seconds that the client waits for a transport to become available. The default is 1 second. The minimum supported value is 0 and -1 is used to specify unlimited value.
maxTransports <wlb> Specifies the maximum number of physical connections that can be made for each application process that connects to the DB2 pureScale® instance. The default is -1 (unlimited). However, the default is 1000 if the server accessed is DB2 for z/OS.
maxRefreshInterval <wlb> Specifies the maximum elapsed time in number of seconds before the server list is refreshed. The default is 10 seconds. The minimum supported value is 0.
Table 2. Settings to control automatic client reroute behavior
Element in the <acr> section of the db2dsdriver configuration file Value
enableAcr parameter Specifies whether automatic client reroute is in effect. The default is true. If the server accessed is DB2 for z/OS, the enableAcr parameter should be enabled only when the enableWLB parameter is in effect.
acrRetryInterval parameter The number of seconds to wait between consecutive connection retries. The registry variable DB2_CONNRETRIES_INTERVAL overrides this value. The valid range is 0 to MAX_INT. The default is no wait (0), if DB2_CONNRETRIES_INTERVAL is not set. When enabling automatic client reroute to the DB2 for z/OS data sharing group, the default value of no wait is recommended.
maxAcrRetries parameter The maximum number of connection retries for automatic client reroute. The registry variable DB2_MAX_CLIENT_CONNRETRIES overrides this value. If DB2_MAX_CLIENT_CONNRETRIES is not set, the default is that the connection is tried again for 10 minutes. A value of 0 means that one attempt at reconnection is made. If the server accessed isDB2 for z/OS, the maxAcrRetries is recommended to be set to no higher than 5.
enableAlternateServerListFirstConnect parameter Specifies whether there is an alternate server list that is used only if a failure occurs on the first connection to the data server. The default is false. When the value of enableAlternateServerListFirstConnect is true, automatic client reroute with seamless failover is implicitly enabled, regardless of the other settings that are specified for automatic client reroute in the db2dsdriver configuration file. To use this feature, you also require an <alternateserverlist> element in the db2dsdriver configuration file. This parameter is not supported against DB2 for z/OS.
alternateserverlist parameter Specifies a set of server names and port numbers that identify alternate servers to which a connection is attempted if a failure occurs on the first connection to the database. The alternate server list is not used after the first connection. In a DB2 pureScale environment, the entries in the list can be members of a DB2 pureScale instance. In a non-DB2 pureScale environment, there is an entry for the primary server and an entry for the high availability disaster recovery (HADR) standby server. The alternate server list is not used after the first connection.
affinityFailbackInterval parameter The number of seconds to wait after the first transaction boundary to fail back to the primary server. Set this value if you want to fail back to the primary server. The default is 0, which means that no attempt is made to fail back to the primary server.
affinitylist <list> elements with serverorder attributes. The serverorder attribute value specifies a list of servers, in the order that they should be tried during automatic client reroute with client affinities. The servers in <list> elements must also be defined in <server> elements in the <alternateserverlist>. You can specify multiple <list> elements, each of which has different server orders. The presence of the <affinitylist> element does not activate automatic client reroute.
clientaffinitydefined <client> elements that define the server order for automatic client reroute for each client. Each <client> element contains a listname attribute that associates a client with a <list> element from the <affinitylist> element.
clientaffinityroundrobin <client> elements whose order in the <clientaffinityroundrobin> element defines the first server that is chosen for automatic client reroute. Each <client> element has an index. The first <client> element in the <clientaffinityroundrobin> element has index 0, the second <client> element has index 1, and so on. Suppose that the number of servers in the <alternateserverlist> element is n and the index in the <clientaffinityroundrobin> element of a <client> element is i. The first server to be tried is the server whose index in the <alternateserverlist> element is i mod n. The next server to be tried is the server whose index in the <alternateserverlist> element is (i +1) mod n), and so on.

The embedded application cannot perform seamless failover. In DB2 Version 9.7 Fix Pack 5 and earlier, the ability to resolve the data source name (DSN) with <dsncollection> section entry in the db2dsdriver.cfg file is only supported by IBM® Data Server Driver Package.

In DB2 Version 9.7 Fix Pack 6 and later fix packs, IBM data server clients supports the use of the <dsncollection> section entry in the db2dsdriver.cfg file to resolve DSN entry.

The following steps outline the process involved with database alias resolution:
  1. The embedded SQL application requests to CONNECT to the database alias.
  2. The embedded SQL application looks up the catalog database directory to see if the specified database alias name exists.
    • If information is found, the embedded application uses the database name, host name, and port number information from the catalog. Proceed to step 4.
    • If information is not found, the <dsncollection> sections in the db2dsdriver.cfg file is used to resolve the database alias name to the database name, host name, and port number information.
  3. The application looks for database alias information in the db2dsdriver.cfg file:
    • If database alias information is not found, a database connection error is returned to the embedded SQL application.
    • If database alias information is found, the database name, host name, port number, and data server driver parameters that are specified in the <dsn> section are used.
  4. Using the database name, host name, and port number, the <databases> section for matching entry is searched.
  5. If a matching entry for the database name, host name, and port number is found in the <databases> section, the parameters specified under the matching <database> section is applied to the connection.
  6. The database connection is attempted with information that is specified in the catalog and db2dsdriver.cfg file.
In DB2 Version 9.7 Fix Pack 6 and later fix packs, the embedded SQL application can use following timeout values in the db2dsdriver.cfg file:
  • MemberConnectTimeout
  • ReceiveTimeout
  • TcpipConnectTimeout
  • keepAliveTimeOut
  • ConnectionTimeout
Any unrecognized data server keywords are ignored silently by the embedded SQL application.