Operation of automatic client reroute for connections from Java clients to Db2 for z/OS
Automatic client reroute support provides failover support when an IBM® data server client loses connectivity to a member of a Db2 for z/OS sysplex. Automatic client reroute enables the client to recover from a failure by attempting to reconnect to the database through any available member of the sysplex.
Automatic client reroute is enabled by default when sysplex workload balancing is enabled. Automatic client reroute should never be enabled when sysplex workload balancing is disabled.
Client support for automatic client reroute is available in IBM data server clients that have a Db2 Connect license. The Db2 Connect server is not required to perform automatic client reroute.
Automatic client reroute for connections to Db2 for z/OS operates in the following way:
- The IBM Data Server Driver for JDBC and SQLJ uses the distributed IP address as the group IP address to establish the initial connection to the data sharing group. If the connection to the group IP address fails, the connection is retried five times, with no wait between retries.
- If an SQL statement in the transaction fails, and a connection is reestablished with the data server:
- Starting with version 4.32 of the IBM Data Server Driver for JDBC and
SQLJ:
- If IBM Data Server Driver for JDBC and
SQLJ property enableSeamlessFailoverErrorCodes is not set or is set to
false
, the statement receives SQL error -4499. - If IBM Data Server Driver for JDBC and
SQLJ property enableSeamlessFailoverErrorCodes is set to
true
, the statement receives SQL error -30108.
- If IBM Data Server Driver for JDBC and
SQLJ property enableSeamlessFailoverErrorCodes is not set or is set to
- Before version 4.32 of the IBM Data Server Driver for JDBC and SQLJ, if failover is not seamless, the application receives SQL error -30108. All work that occurred within the current transaction is rolled back.
If the connection to the data server is dropped, and the automatic client reroute feature fails to execute an SQL statement:- Starting with version 4.32 of the IBM Data Server Driver for JDBC and
SQLJ:
- If IBM Data Server Driver for JDBC and
SQLJ property enableSeamlessFailoverErrorCodes is not set or is set to
false
, the statement receives SQL error -4499. - If IBM Data Server Driver for JDBC and
SQLJ property enableSeamlessFailoverErrorCodes is set to
true
, the statement receives SQL error -20542.
- If IBM Data Server Driver for JDBC and
SQLJ property enableSeamlessFailoverErrorCodes is not set or is set to
- Before version 4.32 of the IBM Data Server Driver for JDBC and SQLJ, if the automatic client reroute feature fails to execute an SQL statement, the statement receives SQL error -20542.
If multiple SQL errors occur, the underlying cause might be server-side abends or errors. The Db2 for z/OS administrator needs to investigate those abends or errors.
- Starting with version 4.32 of the IBM Data Server Driver for JDBC and
SQLJ:
- The application retries the transaction.
- The driver attempts to acquire a transport to each member of the data sharing group in the order of their calculated priorities (WLM member weights) until a transport is acquired. The driver does not attempt to acquire a transport to the member to which the connection failed in step 2.
- If the driver cannot acquire a transport, the driver attempts to contact the group IP address to check for any members that have become available.
- If the driver still cannot acquire a transport, the driver continues to execute steps 4 and 5 until a transport is acquired.