Automatic client reroute description and setup (DB2 Connect)

 

The main goal of the automatic client reroute feature is to enable an IBM® Data Server Client application to recover from a loss of communications so that the application can continue its work with minimal interruption. As the name suggests, rerouting is central to the support of continuous operations. But rerouting is only possible when there is an alternate location that is identified to the client connection. In a non-DB2 Connect high-availability environment, the database being accessed is typically synchronized between the original DB2® server and the alternate DB2 server through one of various means, such as High availability cluster multiprocessor (HACMP™) or High availability disaster recovery (HADR).

However, in the case of the DB2 Connect™ server, because there is no requirement for the synchronization of local databases, you only need to ensure that both the original and alternate DB2 Connect servers have the target host or System i™ database catalogued in such a way that it is accessible using an identical database alias.

Note: In a DB2 Connect server environment, an alternate DB2 Connect server can be specified to enable automatic rerouting between a client and the DB2 Connect server. For rerouting to occur between the DB2 Connect personal or server products and a host or System i database server, the remote server must provide one or more alternate addresses for itself. In the case of DB2 for z/OS®, multiple addresses are known if the database is a Sysplex data sharing environment.

Rerouting capability for Sysplex can be configured between DB2 Connect and the host database server if Sysplex support is enabled. The rerouting capability for Sysplex is a DB2 Connect feature that allows DB2 Connect to retry the connection against other members of the Sysplex group following the loss of communication with the original member. The alternate server does not need to be cataloged in the database directory to enable the reroute capability for Sysplex on DB2 Connect. By default, the reroute capability for Sysplex is enabled if Sysplex support is enabled.

In order for an IBM Data Server Client to have the ability to recover from a loss of communications to a DB2 Connect server using automatic client reroute, an alternate DB2 Connect server location must be specified before the loss of communication occurs. The UPDATE ALTERNATE SERVER FOR DATABASE command is used to define the alternate DB2 Connect server location for a particular host or System i database. The alternate hostname and port number is given as part of the command. The location is stored in the system database directory file at the DB2 Connect server. In order to ensure the alternate DB2 Connect server location specified applies to that database for all clients, the alternate server location has to be specified at the DB2 Connect server side. The alternate server is ignored if it is set at the client instance.

For example, suppose a host or System i database is catalogued using a database alias of db1 at a DB2 Connect server S1 (with a hostname of db2conn1 and a port number of 122). The database administrator would like to specify an alternate DB2 Connect server S2 at hostname db2conn2 with a port number of 123. Here is the command the database administrator would run at the DB2 Connect server S1:

   db2 update alternate server for database db1 using hostname db2conn2 port 123

After you have specified the alternate DB2 Connect server location for database alias db1 at DB2 Connect server S1, the alternate server location information is returned to the IBM Data Server Client as part of the connection process. If communication between the IBM Data Server Client and the DB2 Connect server S1 is lost for any reason (typically a communication error, such as SQL code -30081 or SQL code -1224), the IBM Data Server Client will attempt to reconnect to db1 through either the original DB2 Connect server (S1) or the alternate DB2 Connect server (S2), alternating the attempts between the two servers. The time interval between attempts starts off rapidly, then gradually lengthens with each attempt.

Once a connection is successful, the SQL code -30108 is returned to indicate that a database connection has been reestablished following the communication failure. The hostname or IP address and service name or port number are returned. The IBM Data Server Client only returns the error for the original communications failure to the application if the reestablishment of the client communications is not possible to either the original or alternative server.

The following considerations involving alternate server connectivity in a DB2 Connect server environment should also be noted:

Related concepts
Client reroute setup when using IBM Data Server Driver for JDBC and SQLJ Automatic client reroute description and setup Automatic client reroute limitations

Related reference
Automatic client reroute examples Automatic client reroute roadmap