lock request time out period exceeded

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
boutwater
Posts: 6
Joined: Fri 14 Aug 2009 14:00

lock request time out period exceeded

Post by boutwater » Fri 14 Aug 2009 14:07

I've been getting this error returned to me quite often from SQL lately at one of my customer sites. I am able to catch it and just not let it hand my program, but I don't know how to handle it properly. While doing research, I read that I should catch the error and then roll back the transaction, but I do not know how to do that. Do you have any sample code on handling SQL errors such as this? I use Borland c++ Builder Pro 6 with SDAC 4.7. Any help on this matter would be greatly appreciated. Thank you in advance,

Ben

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Tue 18 Aug 2009 12:55

You can process it using the TMSConnection.OnError event handler. Or you can put the code that updates or locks the record into try ... except block.

boutwater
Posts: 6
Joined: Fri 14 Aug 2009 14:00

Post by boutwater » Wed 19 Aug 2009 15:34

thank you for the reply. I do have the MSQuery->Execute() in a try catch block, but my question is more towards, is it necessary to roll the transaction back, or release the lock? Or does this happen automatically when SQL returns the error? Right now, I am just catching the error, setting a bool saying it had an error, and then retrying the query. Thanks,

Ben

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Fri 21 Aug 2009 07:49

If you have explicitly started transaction you should rollback it.

boutwater
Posts: 6
Joined: Fri 14 Aug 2009 14:00

Post by boutwater » Wed 21 Oct 2009 18:10

Okay, so I now catch the error and handle it, but I'm wondering why this error just started happening since I switched to sdac 4.7. I was previously using sdac 2.x since around 2003, and never came across this issue. Now that I've switched to sdat 4.7, I get this issue all the time. Is there some option that I'm missing? Thanks,

Ben

tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

Post by tonisanta » Fri 23 Oct 2009 16:51

Hi, I've the same problem, but only with two or three customers. Seems to be SQL-Server issue. After changing the Connection.Options.DefaultLockTimeout from 2000 to 6000 the problem seems gone. But I'm not shure about this since this change I did only with my last upgrade of my application some week ago. Please, try for yourself an let us know if this resolved your problem.
best regards, toni

Dimon
Devart Team
Posts: 2888
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 26 Oct 2009 11:01

Was the problem solved?
If not, please try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.

Post Reply