If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > deadlock or timeout

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-11-04, 05:34
jmychung jmychung is offline
Registered User
 
Join Date: Oct 2003
Location: Hong Kong
Posts: 41
Question deadlock or timeout

Hi,

I have a java program which spawn n threads inserting rows into the same table. I got the following exception:

COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0911N The current transaction has been rolled back because of a deadlock or timeout. Reason code "2". SQLSTATE=40001

I issued the following command and reboot the system but can't solve the problem:
db2set DB2_RR_TO_RS=YES -g

Can anyone help me? Thanks a lot!
Reply With Quote
  #2 (permalink)  
Old 05-11-04, 06:57
RKrick RKrick is offline
Registered User
 
Join Date: Feb 2002
Location: Germany
Posts: 141
How offen are you writing "commits" in these transactions?
__________________
Rodney Krick
Reply With Quote
  #3 (permalink)  
Old 05-11-04, 21:44
jmychung jmychung is offline
Registered User
 
Join Date: Oct 2003
Location: Hong Kong
Posts: 41
The program spawn 2 threads each insert 2500 rows then commit. One thread fails with error described above, and the other thread completes successfully.
Reply With Quote
  #4 (permalink)  
Old 05-11-04, 21:48
jmychung jmychung is offline
Registered User
 
Join Date: Oct 2003
Location: Hong Kong
Posts: 41
The program can be run with Oracle very well.
Reply With Quote
  #5 (permalink)  
Old 05-12-04, 02:57
RKrick RKrick is offline
Registered User
 
Join Date: Feb 2002
Location: Germany
Posts: 141
You can try to increase your LOCKTIMEOUT parameter (be carefull with side effects on another applications), commit more frequently or both.
The lock implementation in Oracle and in DB2 is different. While Oracle makes a copy from the "old" entity (redo log) and allows others to access the data, DB2 sets a x-lock by INSERTS, UPDATES and DELETES and gets exclusive control over the data.
HTH
__________________
Rodney Krick
Reply With Quote
  #6 (permalink)  
Old 05-12-04, 03:09
jmychung jmychung is offline
Registered User
 
Join Date: Oct 2003
Location: Hong Kong
Posts: 41
Thank you RKrick.

My current setting of LOCKTIMEOUT is -1, means I don't have such setting.
Also, I tried to increase another parameter DLCHKTIME buy no use.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On