Technical Blog Post
50 DB2 Nuggets #33 : Tech Tip - Automatic Client re-route for JCC Client through DB2 Connect gateway
One of our clients has a JCC application going through a DB2 Connect gateway connecting to DB2/Z database, instead of direct connection to DB2/Z. They wanted to know how to setup the automatic client re-route(ACR) if the DB2 Connect goes down.
Here are the steps:
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 IBM mainframe database cataloged in such a way that it is accessible using an identical database alias.
You can use one of the following steps to configure Automatic Client re-route in JCC:
1) ACR in DB2 Connect is explained here in detail:
i) 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 IBM mainframe 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.
ii) Suppose a IBM mainframe database is cataloged 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.
iii) On the JCC datasource for this DB2 Connect server, specify the clientRerouteAlternateServerName and clientRerouteAlternatePortNumber properties to the hostname and port number of the alternate DB2 Connect server.
1) This step is to use just the Driver level re-route using Client affinities setup:
Client affinities is a client-only method for providing automatic client reroute capability. All rerouting is controlled by the driver.
clientRerouteAlternateServerName= db2connect1, db2connect2
clientRerouteAlternatePortNumber = port1,port 2
maxRetriesForClientReroute The number of times to retry the connection to each server, including the primary server, after a connection to the primary server fails. The default is 3.
retryIntervalForClientReroute The number of seconds to wait between retries.
Here is an example of how it works: