MsSQL Lock request timeout period exceeded error

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Tugrul Tamturk
Posts: 32
Joined: Mon 25 Aug 2008 18:28

MsSQL Lock request timeout period exceeded error

Post by Tugrul Tamturk » Fri 13 Mar 2009 10:18

Hi,

I converted my project ADO to UniDac. We installed the new version software to the client two weeks ago. Since then my client users start to complain about sql error : "Lock request timeout period exceeded".

I used same parameters as ADO.. Do I have to consider any other parameters?? Any Help?

Thanks
Tugrul

Tugrul Tamturk
Posts: 32
Joined: Mon 25 Aug 2008 18:28

Re: MsSQL Lock request timeout period exceeded error

Post by Tugrul Tamturk » Tue 17 Mar 2009 03:35

Is it too difficult problem? My customer is getting this bug every day, and start to complain about...

Is it side-effect of UniDAC components?

Please help..

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 17 Mar 2009 12:48

This error may occur when a TUniTable component locks a record on editing. Try to set the LockMode property of TUniTable to lmNone.

Tugrul Tamturk
Posts: 32
Joined: Mon 25 Aug 2008 18:28

Post by Tugrul Tamturk » Tue 17 Mar 2009 19:26

Thank you for replay. I will try and return the results.

Tugrul Tamturk
Posts: 32
Joined: Mon 25 Aug 2008 18:28

Post by Tugrul Tamturk » Wed 01 Apr 2009 17:10

My Client does not complain anymore. Thanks.

Tugrul Tamturk
Posts: 32
Joined: Mon 25 Aug 2008 18:28

Post by Tugrul Tamturk » Tue 14 Apr 2009 00:28

Problem re-arised again. Now, I found UniConnection.SpecificOptions.Values['LockTimeout'] options is 2000.. It must be enough, but in anycase I assigned a greater value.

Any other suggestions will be appreciated..

Thanks

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 15 Apr 2009 07:07

Please specify whether you are using record locking in your program. If you don't lock records, the LockTimeout option has no effect.

Tugrul Tamturk
Posts: 32
Joined: Mon 25 Aug 2008 18:28

Post by Tugrul Tamturk » Wed 22 Apr 2009 01:43

Hi,
My default creation codes like this.

//Connection Creation
Cn := TUniConnection.Create(Nil);
Cn.SpecificOptions.Values['CommandTimeOut'] := '9000';
Cn.SpecificOptions.Values['LockTimeout'] := '9000';
Cn.Server := Server;
Cn.Database := aDatabase;
Cn.Username := aUsername;
Cn.Password := aPassword;
Cn.LoginPrompt := False;
Cn.ProviderName := aProviderName;
Cn.Connected := True;

//Query Creation
Q := TUniQuery.Create(Owner);
Q.Connection := fUniConnection;
Q.Options.RequiredFields := False;
Q.SpecificOptions.Values['CommandTimeOut'] := '9000';// CommandTimeOut := 900;
Q.LockMode := lmNone;

//UniSql Creation
UC := TUniSQL.Create(Self);
UC.SpecificOptions.Values['CommandTimeOut'] := '9000';

Tugrul Tamturk
Posts: 32
Joined: Mon 25 Aug 2008 18:28

Post by Tugrul Tamturk » Wed 22 Apr 2009 01:47

I don't use transaction sql in the code. If LockMode is lmNone, why Lock timeout request expire ?? Why query try to lock?? I don't understant Unidac lock mechanism..

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 22 Apr 2009 08:00

Maybe records are locked by another application that works with the same database. Please specify whether only your application works with the database.

tobias_cd
Posts: 56
Joined: Thu 18 Dec 2008 22:10

Post by tobias_cd » Fri 15 May 2009 06:20

Tugrul Tamturk wrote:I don't use transaction sql in the code. If LockMode is lmNone, why Lock timeout request expire ?? Why query try to lock?? I don't understant Unidac lock mechanism..
Hi Tugrul,
have you resolved your locking issue in the meantime?
We had similar issues in the beginning and have found that for multi-user usage the lock mode for SQL Server should be pessimistic and for Oracle optimistic. lmNone should only be used in single user application.
Starting with SQL Server 2005 you could also enable Snapshots in the database (requires most likely an alter database statement to allow that and also a specific isolation level).
The issues are not with Unidac at all, but with how SQL Server uses locks on either rows, pages or full tables, which is done automatically and not foreseeable. I'd highly recommend use google to find more explanations and look up the SQL Server documentation on MSDN.
Regards,
Tobias

Post Reply