The SQLDB Bluemix Service's Premium Plan enables DB2 High Availability. However, the default JDBC URL provided by service credentials uses more forigiving timeouts than I would like to use. Here is an example of the default JDBC URL:
jdbc:db2://1.1.1.1:50001/DBName:clientRerouteAlternateServerName=2.2.2.2;clientRerouteAlternatePortNumber=50001;sslConnection=true;
From various experiments, it looks like the default timeouts are:
- initial connection timeout: 2 minutes
- socket read timeout: whatever is the default for the operating system. I've read that it can be more than an hour.
In a failure scenario where the primary server is suddenly unavailable, existing connections will remain "open" until the socket read timeout is reached. This can make it appear that requests on that connection have "hung". Additionally, any attempts to make a new connection will take 2 minutes or more because of the default connection timeout of 2 minutes.
I would like to use smaller timeouts to ensure a higher degree of application availability. I tried tweaking various JDBC URL parameters myself, but I managed to break failover a few times. So I though it was time to ask the experts:
What DB2 JDBC timeout-related parameters should I set or change in order to control the initial connection timeout and the socket read timeouts (and without breaking failover to the secondary server)?