Question:
---------
How to set a timeout on the db2 server or client, so that when no response from the server after the request timeout seconds, the client gets some error back.
The main reason for the timeout is that we don't want the applications hang forever in some scenarios such as the one below:
1) application A requested an update on a table but not committed yet. The network connection is lost between the application and the DB2 server, before application A to commit.
2) application B wants to access the whole table but it is locked by application A.
3) any applications are affected if want to access the whole table.
DB2 v9 on Linux, run Java over JDBC to talk to DB2.
---------
Here is the info I have on how to solve this situation:
- If using legacy jdbc driver, set QUERYTIMEOUTINTERVAL = XXX in [common] section of db2cli.ini to get it timed out.
- If using jcc driver, there are several different timeout parameters in jcc datasource properties (ie. blockingReadConnectionTimeout).
- Another possibility is with the TCP/IP keepalive setting or registry variables (maybe DB2TCP_CLIENT_RCVTIMEOUT?) described here:
IBM - TCP/IP keepalive settings and related DB2 registry variables
Is there any other way? I don't have any additional information about client/java.