如何避免锁定等待超时超出异常。 [英] How to Avoid Lock wait timeout exceeded exception.?
本文介绍了如何避免锁定等待超时超出异常。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
java.sql.SQLException: Lock wait timeout exceeded; try restarting tra
nsaction at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.ja
va:2077)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:
2228)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:
208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1812)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:259)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1885)
... 131 more
$更新记录时,我得到的重复锁定超时超出异常。
I am getting repeated lock timeout exceeded exception while I update the records.
我正在使用Java Struts 2.1 Hibernate配置。
数据库使用的是MYSQL。
I am using Java Struts 2.1 Hibernate configuration. DB Used is MYSQL.
任何人都知道如何解决它.. ??
Anyone know how to solve it..??
推荐答案
以下是一些建议:
Here are some suggestions:
- '锁定等待超时'通常会发生当一个事务正在等待更新的数据行时,这个行已经被其他事务锁定了。
- 大多数情况下,问题出在数据库方面。可能的原因可能是不适当的表设计,大量的数据,约束等。 请检查此详细解答。
- ‘Lock wait timeout’ occurs typically when a transaction is waiting on row(s) of data to update which is already been locked by some other transaction.
- Most of the times, the problem lies on the database side. The possible causes may be a inappropriate table design, large amount of data, constraints etc.
- Please check out this elaborate answer .
这篇关于如何避免锁定等待超时超出异常。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文