Start a waiting Transaction

Posts   
 
    
Posts: 3
Joined: 18-Sep-2012
# Posted on: 18-Sep-2012 10:32:02   

Hi,

i have some statements which have to be executed as once on no other client are allowed to execute the statements at the same time. For this i use transactions with RepeadableRead (i also used ReadCommitted). But the transaction doesn't wait if another transaction is active. A deadlock-Exception is thrown immediately.

Is there a way to set the Transaction to wait and set a wait timeout ? Are Transactions the right way for this ?

Greets Christian

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 18-Sep-2012 20:25:42   

I would suggest handling this at the application layer, using critical sections and/or semaphores.

Posts: 3
Joined: 18-Sep-2012
# Posted on: 19-Sep-2012 11:08:06   

Ok Handling this at the application layer might be a possibility.

But this functionality exists in Firebird.


SET TRANSACTION ISOLATION LEVEL READ COMITTED WAIT LOCK TIMEOUT 60;

If one transaction updates a row and a second transactions tries to fetch this row, then the second transaction waits till the first transaction does an commit or rollback.

How can i start this kind of transaction with llblgen ?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 19-Sep-2012 17:40:15   

Please check this link: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=16508

I think same concept applies as NoLock.

Posts: 3
Joined: 18-Sep-2012
# Posted on: 20-Sep-2012 17:50:57   

Thanks Walaa for this hint.

I finally solved this by overwriting the Methode CreatePhysicalTransaction of an inherited DataAccessAdapter. In this method you can create the Database-Transaction at your own.