Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2003
    Location
    Hong Kong
    Posts
    41

    Question Unanswered: 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!

  2. #2
    Join Date
    Feb 2002
    Location
    Germany
    Posts
    141
    How offen are you writing "commits" in these transactions?
    Rodney Krick

  3. #3
    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.

  4. #4
    Join Date
    Oct 2003
    Location
    Hong Kong
    Posts
    41
    The program can be run with Oracle very well.

  5. #5
    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

  6. #6
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •