DB2死锁超时Sqlstate:40001,原因代码68由于使用SQL从servlet调用的更新语句 [英] DB2 deadlock timeout Sqlstate: 40001, reason code 68 due to update statements called from servlet using SQL

查看:4986
本文介绍了DB2死锁超时Sqlstate:40001,原因代码68由于使用SQL从servlet调用的更新语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从servlet到DB2调用update语句。我收到错误sqlstate 40001,原因代码68,我发现它是由于死锁超时。




  • 我如何解决这个问题? / li>
  • 可以通过设置查询超时来解决吗?

  • 如果是,那么如何在servlet中使用update语句或在哪里使用它? li>

解决方案

原因码68已经告诉你这是由于锁定超时(死锁是原因码2)这可能是由于其他用户在使用您正在访问的相同数据的同时运行查询,或者您自己的多个更新。



开始运行 db2pd -db locktest -locks从db2命令行显示详细信息,以查看锁的位置。然后,您需要运行以下操作:

 从syscat.tables中选择tabschema,tabname,tableid,tbspaceid 
其中tbspaceid =#和tableid =#

填写#号,带有您从



一旦你看到锁的位置,这里有一些提示:



◦有时可以通过确保所有应用程序以相同的顺序访问其公共数据,有时可以降低固定频率 - 例如,它们访问(因此锁定)表A中的行由表B,其次是表C,等等。



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



推荐阅读: http://www.ibm.com/developerworks/data/library/techarticle/dm-0511bond/index.html



附录:如果您的servlet或其他有罪应用程序正在使用选择发现涉及死锁的语句,则可以尝试附加< a href =http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db2z10.doc.perf/src/tpc/db2z_isour.htm =noreferrer> 与ur 选择语句,如果新更新(或插入)数据的准确性不重要。


I am calling update statements one after the other from a servlet to DB2. I am getting error sqlstate 40001, reason code 68 which i found it is due to deadlock timeout.

  • How can I resolve this issue?
  • Can it be resolved by setting query timeout?
  • If yes then how to use it with update statements in servlet or where to use it?

解决方案

The reason code 68 already tells you this is due to a lock timeout (deadlock is reason code 2) It could be due to other users running queries at the same time that use the same data you are accessing, or your own multiple updates.

Begin by running db2pd -db locktest -locks show detail from a db2 command line to see where the locks are. You'll then need to run something like:

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

filling in the # symbols with the ID number you get from the db2pd command output.

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

◦Deadlock frequency can sometimes be reduced by ensuring that all applications access their common data in the same order – meaning, for example, that they access (and therefore lock) rows in Table A, followed by Table B, followed by Table C, and so on.

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 another guilty application is using select statements found to be involved in the deadlock, you can try appending with ur to the select statements if accuracy of the newly updated (or inserted) data isn't important.

这篇关于DB2死锁超时Sqlstate:40001,原因代码68由于使用SQL从servlet调用的更新语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆