IBM DB2 Manual page 108

Table of Contents

Advertisement

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92
Application Programming Guide and Reference for Java
c. If reconnection to the primary server fails, the IBM Data Server Driver for
JDBC and SQLJ attempts to connect to the alternate servers.
If this is not the first connection, the latest alternate server list is used to
find the next alternate server.
Reconnection to the primary server is called failback. Connection to an alternate
server is called failover.
The IBM Data Server Driver for JDBC and SQLJ uses the
maxRetriesForClientReroute and retryIntervalForClientReroute properties to
determine how many times to retry the connection and how long to wait
between retries. An attempt to connect to the primary server and alternate
servers counts as one retry.
4. If the connection is not established, maxRetriesForClientReroute and
retryIntervalForClientReroute are not set, and the original serverName and
portNumber values that are defined on the DataSource are different from the
serverName and portNumber values that were used for the original connection,
retry the connection with the serverName and portNumber values that are
defined on the DataSource.
5. If failover is successful during the initial connection, the driver generates an
SQLWarning. If a successful failover occurs after the initial connection:
v If seamless failover is enabled, the driver retries the transaction on the new
server, without notifying the application.
The following conditions must be satisfied for seamless failover to occur:
– The enableSeamlessFailover property is set to DB2BaseDataSource.YES (1).
If Sysplex workload balancing is in effect (the value of the
enableSysplexWLB is true), seamless failover is attempted, regardless of
the enableSeamlessFailover setting.
– The connection is not in a transaction. That is, the failure occurs when the
first SQL statement in the transaction is executed.
– There are no global temporary tables in use on the server.
– There are no open, held cursors.
– For DB2 for z/OS servers, inactive thread support is disabled. Inactive
thread support is disabled in one of the following ways:
- Subsystem parameter CMTSTAT is set to ACTIVE.
- CMTSTAT is set to INACTIVE, but the application is bound with option
KEEPDYNAMIC(YES).
v If seamless failover is not in effect, the driver throws an SQLException to the
application with error code -4498, to indicate to the application that the
connection was automatically reestablished and the transaction was implicitly
rolled back. The application can then retry its transaction without doing an
explicit rollback first.
A reason code that is returned with error code -4498 indicates whether any
database server special registers that were modified during the original
connection are reestablished in the failover connection.
You can determine whether alternate server information was used in
establishing the initial connection by calling the
DB2Connection.alternateWasUsedOnConnect method.
6. After failover, driver memory is updated with new primary and alternate
server information from the new primary server.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents