Page 1 of 1

lock request time out period exceeded

Posted: Fri 14 Aug 2009 14:07
by boutwater
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

Posted: Tue 18 Aug 2009 12:55
by Challenger
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.

Posted: Wed 19 Aug 2009 15:34
by boutwater
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

Posted: Fri 21 Aug 2009 07:49
by Challenger
If you have explicitly started transaction you should rollback it.

Posted: Wed 21 Oct 2009 18:10
by boutwater
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

Posted: Fri 23 Oct 2009 16:51
by tonisanta
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

Posted: Mon 26 Oct 2009 11:01
by Dimon
Was the problem solved?
If not, please try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.