If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to timeout client when no response from server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-22-09, 00:03
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
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.
Reply With Quote
  #2 (permalink)  
Old 11-22-09, 10:01
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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.
Reply With Quote
  #3 (permalink)  
Old 11-22-09, 10:07
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
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
Reply With Quote
  #4 (permalink)  
Old 11-22-09, 23:22
sawangupta sawangupta is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 11-23-09, 17:22
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Thank you all.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On