DB2 Sqlstate lockout timeout: 40001, reason code 68 due to update statements invoked from a servlet using SQL

I call the update statements one by one from a servlet in DB2. I am getting sqlstate 40001 error, reason code 68, which I discovered due to a lock timeout.

  • How can I solve this problem?
  • Can this be solved by setting the request timeout?
  • If so, how to use it with update instructions in the servlet or where to use it?
+8
db2
source share
1 answer

Reason code 68 is already telling you this because of the lock timeout (deadlock is reason code 2). This may be due to the fact that other users making requests are using the same data that you are accessing at the same time, or your own multiple updates.

Start by running db2pd -db locktest -locks show detail from the db2 command line to find out where the locks are. Then you need to run something like:

 select tabschema, tabname, tableid, tbspaceid from syscat.tables where tbspaceid = # and tableid = # 

filling # characters with the identification number that you get from the output of the db2pd command.

Once you see where the locks are, here are some tips:

◦ The blocking frequency can sometimes be reduced by ensuring that all applications access their shared data in the same order, that is, for example, that they access (and therefore block) the rows in table A and then table B, and then table C, etc.

taken from: http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.trb.doc/doc/t0055074.html

recommended reading: http://www.ibm.com/developerworks/data/library/techarticle/dm-0511bond/index.html

Addendum: if your servlet or other guilty application uses select statements found in a dead end, you can try adding with ur to the select statements if the accuracy of the updated (or inserted) data is not important.

+11
source share

All Articles