简单查询时出现 ODBC 超时错误

发布于 2024-09-04 17:34:56 字数 372 浏览 1 评论 0原文

针对 SQL Server 数据库执行 SQL 代码时,我们遇到以下 ODBC 超时错误。

“连接错误:[Microsoft][ODBC SQL Server 驱动程序]超时已过期” “S1T00”

这里令人困惑的是,我们的堆栈转储表明发生超时时正在执行的 SQL 代码非常简单:

SELECT @@TRANCOUNT AS TranCount

或有时...

BEGIN TRANSACTION

我们的客户端说,数据库服务器在发生这些错误时,并不是压倒性的。什么可能导致这些简单的语句超时?我相信超时设置相当短(1 到 5 秒之间)...但是,SELECT @@TRANCOUNT 应该是瞬时的。

有什么想法吗?

We are getting the following ODBC timeout errors when executing sql code against a SQL Server database.

"Connectivity error: [Microsoft][ODBC SQL Server Driver]Timeout expired"
"S1T00"

The confusing thing here is that our stack dump says that the SQL code it is executing when the timeout occurrs - is very simple:

SELECT @@TRANCOUNT AS TranCount

or sometimes...

BEGIN TRANSACTION

Our client says that the load on the database server at the time that these errors occur, is not overwhelming. What could possibly cause those simple statements to timeout? I believe the timeout setting is fairly short (between 1 and 5 seconds)... but still, SELECT @@TRANCOUNT should be instantaneous.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荆棘i 2024-09-11 17:34:56

它可能与驱动程序相关,但我认为 ODBC 超时可能由客户端处理。这意味着,任何网络延迟,甚至是由病毒扫描程序到其他进程等任何原因引起的轻微服务器中断,都可能很容易导致 1 或 2 秒的延迟。因此,如果您的超时实际上是 1 秒,那么出现超时错误似乎并不奇怪。

对于合理的超时时间来说,即使是 5 秒似乎也有点偏低。这是假设客户端和服务器不在同一台物理机器上。

It may be driver-dependent, but I think the ODBC timeout may be handled by the client. This means that any network delays or even slight server hiccups caused by anything from a virus scanner to miscellaneous processes could easily cause a 1 or 2 second delay. So if your timeout is actually 1 second, it doesn't seem surprising that you might get timeout errors.

It seems that even 5 seconds is a bit on the low side for a reasonable timeout. This is assuming that the client and server are not on the same physical machine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文