MySQL ODBC 错误“服务器已消失”

发布于 2024-09-28 20:35:56 字数 419 浏览 0 评论 0原文

有时,我们会在 ASP 页面中看到错误:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[MySQL][MyODBC 5.00.11][MySQL] 2006 MySQL server has gone away

我们已在 ASP 中尽最大努力处理该错误,但该错误仍然会出现。我认为这更多地与 MySQL ODBC 驱动程序有关,而不是与 ASP 代码有关。我们在同一 IIS 服务器下运行的 PHP 代码从未见过这种情况,但是 PHP 每次运行时都会重新连接,而我相信 ODBC 驱动程序连接一次并保持连接。

我已经检查了驱动程序中的设置,但似乎没有任何可以更改的内容来帮助缓解问题。

谁能解释为什么会发生这种情况以及如何减少发生这种情况的次数?

Occasionally we're seeing an error from ASP pages:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[MySQL][MyODBC 5.00.11][MySQL] 2006 MySQL server has gone away

We're handling it the best way we can in ASP but it still crops up. I think it's more to do with the MySQL ODBC driver than the ASP code. We never see this with PHP code we also have running under the same IIS server, however PHP re-connects each time it is ran, whereas I believe the ODBC driver connects once and stays connected.

I've checked the settings in the driver but there doesn't seem to be anything I can change to help mitigate the problem.

Can anyone explain why this is happening and how to reduce the number of times it happens?

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

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

发布评论

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

评论(2

橘虞初梦 2024-10-05 20:35:56

问题是连接超时。您无法在 ODBC 级别更改此设置。我通过一个简单的查询每 10 秒轮询一次连接来解决这个问题。这使连接保持活动状态。

The problem is that the connection is timing out. This is not a setting that you can change at the ODBC level. I got round it by polling the connection every 10 seconds with a simple query. That keeps the connection alive.

墨落成白 2024-10-05 20:35:56

不确定 ASP,但在 Java/Tomcat/DBCP 中,我们能够在实际获取连接之前在连接池中粘贴一个简单的测试语句(例如 SELECT 1)。也许 ASP 中也有类似的东西?

Not sure about ASP, but in Java/Tomcat/DBCP we have ability to stick a simple test statement (such as SELECT 1) in connection pools before actually getting the connection. Maybe there is something similar in ASP, too?

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