Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367

    Unanswered: How to timeout client when no response from server

    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.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    That's about it. DB2 client does not monitor the connection status - it sends a request and waits for a response. If the connection breaks at the network level the client won't even know it until it tries to use the connection again.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by db2girl View Post
    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.

    DB2 v9 on Linux, run Java over JDBC to talk to DB2.
    You can try to call setQueryTimeout() before running the statement. But this is an optional method and might not be implemented by the JDBC driver

  4. #4
    Join Date
    Nov 2009
    Location
    Bangalore
    Posts
    25
    How about DB2TCP_CLIENT_RCVTIMEOUT, have you tried that ?

    Communications variables - IBM DB2 9.7 for Linux, UNIX, and Windows

    Regards,
    Sawan Gupta

  5. #5
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    Thank you all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •