Db2 HADR (active-passive with automatic client reroute) configuration

Scenario

The configuration consists of two nodes: a primary read/write node and a standby node. If the primary node fails, the standby node takes over.

Best practice

Define the alternate server directly in the properties. The following example shows the XML configuration:

<dataSource id="twsdb" jndiName="jdbc/twsdb">
                <connectionManager 
                minPoolSize="5" 
                maxPoolSize="80" 
                connectionTimeout="180s"/>
                <properties.db2.jcc 
                databaseName="TWS" 
                serverName="primary-node.example.com" 
                portNumber="50000" 
                clientRerouteAlternateServerName="standby-node.example.com" 
                clientRerouteAlternatePortNumber="50000" 
                enableSeamlessFailover="1" 
                maxRetriesForClientReroute="10" 
                retryIntervalForClientReroute="5"/>
                </dataSource>
Note: The enableSeamlessFailover="1" property sets the Db2 driver to attempt to replay the transaction on the standby node without returning an exception to HCL Workload Automation.