dbTalk Databases Forums  

Issue with using with (updlock) in odbc.

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Issue with using with (updlock) in odbc. in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dantheguy
 
Posts: n/a

Default Issue with using with (updlock) in odbc. - 02-03-2011 , 07:53 AM






I am using version 11.0.1.2527.

My issue is I have two concurrent transactions operating on the same
table from two seperate processes at the same time using odbc. To
solve this issue we are trying to use intent locks to lock the table
at isolation level 3 (serializable), all of this works fine using
sybase central, but when I go to use odbc, the first transaction to
get the lock recieves a deadlock condition and the update statement
fails, where the second goes through fine. I'll show a sample to
illustrate...

Trans 1>
SELECT * FROM TABLE x WITH (UPDLOCK) WHERE COLUMN = y;
<perform fetch>

Trans 2>
SELECT * FROM TABLE x WITH (UPDLOCK) WHERE COLUMN = y;
<fetch called, but as expected is waiting for transaction 1 to
commit or rollback>

Trans 1>
UPDATE TABLE x SET COLUMN = z;
< this update fails with a deadlock condition >

Trans 2>
< this is now able to proceed >
UPDATE TABLE x SET COLUMN = w
< this is successful>

If I switch UPDLOCK to XLOCK, the process is the same except that the
update from transaction 1 is successful. I want both transaction to
be successful, but I don't want to block reader only transactions
running at the same time so I want to not use xlock. I'm not sure why
the behavior would be differerent between the two in this case, nor
why in odbc we recieve a deadlock from this and the error is not
recieved in sybase central. Any ideas? Is there a connection setting
that would control this behavior?

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.