java - Timeout updating DB2 table -


i doing update db2 table (java code):

// code  ripped out brevity... sql.append("update " + table_threads + " "); sql.append("set status = ? "); sql.append("where id = ?");  conn = getconn(); pstmt = conn.preparestatement(sql.tostring()); int idx1 = 0; pstmt.setint(++idx1, status); pstmt.setint(++idx1, id); int rowsupdated = pstmt.executeupdate(); return rowsupdated; 

after long while, rollback , error message:

unsuccessful execution caused deadlock or timeout. reason code 00c9008e, type of resource 00000302, , resource name some.thing.x'000002'. sqlcode=-913, sqlstate=57033, driver=3.57.82

the documentation error -913 says reason code means timeout. resource type, 00000302 table space page, , not recognize resource name @ all.

when run sql itself, works fine:

update my.threads set status = 1 id = 156 

i can select , see status has been updated. (although when run sql during long wait period before timeout, have same issue. takes forever , cancel it).

there several things happening in transaction , don't see other updates table or record. there create/delete triggers on table, no update triggers. don't see selects cursors, or weird isolation level changes. don't see else in transaction cause this.

why getting error? else should in transaction?


edit:

i stepped through code beginning of request gets 'stuck'. seems if there 2 dao's , both of them creating transaction. think might problem.

sorry answer own question, found out problem. homemade framework dao keeps track of it's own connection.

conn = getconn(); 

this return same connection each dao method while in explicit transaction.

while stepping through code, found out method calling in transaction creating new transaction, new dao, , therefore new db connection. have 2 transactions open , 2 connections. it's easy see @ point, in fact deadlocking myself.

this caught me little surprise since previous app worked on allowed nested transactions. (using same db connection both transactions)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -