05-01-08, 19:15 #1Registered User
- Join Date
- May 2008
Unanswered: DB2 SQL Error: SQLSTATE: 40001, SQLERRMC: 68
I am getting the following exception when there are multiple instances of EJB that try to update the same row in the database. I have a sequence number stored in a properties table and two nodes in a cluster have EJBs running that want to increment this sequence number. The exception is occuring when the code does a save on the hiberate DAO object, to update the row.
Could someone please tell me what do I need to do to avoid this error? I would really appreciate your help.
Caused by: com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -911, SQLSTATE: 40001, SQLERRMC: 68
at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.next(WSJ dbcResultSet.java:2419)
at org.hibernate.loader.Loader.doQuery(Loader.java:68 5)
at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:221 1)
... 29 more
05-01-08, 22:24 #2Registered User
- Join Date
- May 2003
You are getting a locktimeout. That means that one of the applications is holding a lock on a resource (probably a row) and another application is trying to acquire an incompatible lock on the same resource. The amount of time the second application waits depends on the setting of locktimeout (in seconds) in the db config. Most people have it set to about 30 seconds (the default is -1 which means wait forever).
Most likely the first application is not committing after the update (insert, update or delete). A commit will release the lock.M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390