问题
I wrote a simple Java application that basically execute an SELECT SQL statement comprising of 4 joined tables. I then execute the SQL statement and save it to a resultSet. When I am looping through the resultSet, on the 200K+ record out of 300K+, I am getting this error message:
SQLCODE=-913 SQLSTATE=57003 SQLERRMC=schema.table; table, driver=4.1xxx
Based on what I have read so far, this means its a deadlock error. Is it possible for this to occur on such a small resultset (300K), and on a select statement?
回答1:
A deadlock occurs when two or more transactions are in a cycle of lock wait for one another, and a lock timeout does not break the cycle. By default, when row locking is performed during a table or index scan, DB2 locks each row before determining whether the row qualifies for the query. Chances are that your table or index scan is taking too long and there are other pending transactions.
Here is a wonderful document about locks for DB2. http://www.ibm.com/developerworks/data/library/techarticle/dm-0509schuetz/ there is also some suggestions on how to solve locking issues.
来源:https://stackoverflow.com/questions/31063300/java-db2-error-sqlcode-913-sqlstate-57003-sqlerrmc-schema-table-table-driver