开发者

Is there any way to set lock_timeout on a database or connection string level?

In SQL 2005/2008 is there any way to set default lock_timeout values.

Anyth开发者_如何学Going at the server, database, or connection string level would be great.


You can't set lock timeout in the connection string, AFAIK. Only with SET LOCK_TIMEOUT.

But surely setting "CommandTimeout" would achieve pretty much the same result per connection.

There is also the server level query wait option set by sp_configure, but I've not used it.


Lock timeout i.e. the amount of time a transaction will wait for a lock before failing is usually an 'application-level' setting, set by the SET LOCK_TIMEOUT command just after the connection is opened.

According to this JDBC driver page, there is also a connection string setting lockTimeout which might be what you're looking for, but I haven't tried it for ODBC:

The number of milliseconds to wait before the database reports a lock time-out. The default behavior is to wait indefinitely. If it is specified, this value is the default for all statements on the connection. Note that Statement.setQueryTimeout() can be used to set the time-out for specific statements. The value can be 0, which specifies no wait.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜