失去与 SQL Server 2005 数据库的 ODBC 连接

发布于 2024-07-12 11:03:05 字数 1049 浏览 11 评论 0原文

我们的一位客户有一个在 SQL Server 2005 后端上运行的应用程序 (FoxPro 9)。 他们间歇性地失去与 SQL Server 数据库的 ODBC 连接。 以下是初始错误信息:

错误消息:连接错误:[Microsoft][ODBC SQL Server 驱动程序][DBNETLIB]ConnectionRead (recv())。

ODBC 错误消息:[Microsoft][ODBC SQL Server 驱动程序][DBNETLIB]ConnectionRead (recv())。

SQL 状态:01000

ODBC 错误号:10054

ODBC 句柄:1

FoxPro 错误号:1526

我们无法在命令上重复此错误。 我们尝试了很多解决方案都没有效果。 我们发现的一种此类硬件基础解决方案描述于:http://support.microsoft。 com/kb/942861/en-us

我提到这一点是因为它几乎完全符合我们所看到的。 但是,我们已经实施了该帖子中列出的所有解决方法(在本帖子中 http://support.microsoft .com/kb/948496 ) - 问题仍然存在。

此问题似乎在执行长时间运行的查询后出现,但我们没有从应用程序或 SQL Server 收到任何超时错误。 我不认为这是空闲超时的结果,因为它有时发生在执行程序的中间。

我不是硬件专家,但网络和服务器(Windows Server 2003)似乎都很快且设计良好。 然而,有时数据库服务器会承受很大的压力。

如果有人对我们可以尝试的事情有任何建议......请告诉我们!

One of our clients has an application (FoxPro 9) running on top of a SQL Server 2005 backend. Intermittently, they are losing their ODBC connection with the SQL Server database. Below is the initial error information:

Err Msg: Connectivity error: [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (recv()).

ODBC Err Msg: [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (recv()).

SQL State: 01000

ODBC Err No: 10054

ODBC Handle: 1

FoxPro Error No: 1526

We cannot duplicate this error on command. We have tried any number of solutions to no avail. One such hardware base solution which we found was described in: http://support.microsoft.com/kb/942861/en-us

I mention this because it almost perfectly matches what we have been seeing. However, we have implemented all the workarounds listed in that posting (and in this one http://support.microsoft.com/kb/948496 ) - and the problem still continues.

This issue seems to show itself after the execution of long running queries, but we are not receiving any timeout errors, either from the application, or from SQL Server. I do not believe that this is the result of an idle timeout, because it sometimes occurs in the middle of an executing program.

I am not a hardware guy, but both the network, and the server (Windows Server 2003), appear to be fast and well designed. There are times however, when the database server is under significant stress.

If anyone has any suggestions on things we could try...please let us know!

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

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

发布评论

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

评论(4

日记撕了你也走了 2024-07-19 11:03:05

只是盲目猜测,但是您是否尝试过运行跟踪并尝试捕获错误事件以及任何 tsql. 这可能会提供一些线索或帮助您看到模式。

Just a shot in the dark, but have you tried running a trace and trying to capture error events as well as any tsql. This might provide some clues or help you to see a pattern.

ヅ她的身影、若隐若现 2024-07-19 11:03:05

使用pb应用程序和ms sql作为数据库,并从一开始就设置2个事务对象。
一个函数使用第一个事务循环游标,并在此循环中,第二个事务对象用于更新另一个表。 如果更新后未使用显式提交(第二个事务 obj),则第一个连接将关闭,并且我收到 [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (recv()) 错误。 一旦我为相应的事务调用适当的提交语句,一切就都变得非常顺利。
是的,错误总是出现在您实际发生崩溃的位置之前的某个位置 - 假设您处于调试模式
有趣的是,Sybase 设法关闭/打开适当的事务,而无需在第二个事务对象上显式发出提交!!!!

Using pb application and ms sql as db, and 2 transaction objects set from the beginning.
One function loops through a cursor using first transaction and within this loop, the second transaction object is used to update another table. If an explicit commit is not used after update(the second transaction obj) then the first connection is shut down and I get [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead (recv()) error. Once I call the appropriate commit statement for the corresponding transaction everything worked like a charm.
And YES, the error is always somewhere before the location you actually get the crash-assuming you are in debug mode.
It is interesting that Sybase managed to close/open the appropriate transaction without any need to explicitly issue a commit on the second transaction object!!!!

稀香 2024-07-19 11:03:05

只是这个问题的后续...部分解决方案。

我确实进行了跟踪,实际上是其中的一些。 我发现这些错误似乎有多种原因。 我能够找到并修复其中一个,但我们仍然在其他地方遇到此错误,并且它们没有出现在我所做的痕迹上。

那么我找到的那个人是怎么回事呢? 好吧,从跟踪中我发现这些 ODBC 错误出现在另一个 SQL Server 错误之后:

Error: 1203, Severity: 20, State: 1.
Process ID 94 attempted to unlock a resource it does not own: OBJECT: 25:1699834390:0 . Retry the transaction, because this error may be caused by a timing condition. If the problem persists, contact the database administrator.

从 FoxPro 代码中我发现插入语句导致了此错误......并不总是......但有时。 在此插入中,他们将一个表中的所有字段以及另一个表中的一些字段提取到第三个表中。 该数据库中的每个表都有一个名为 id_col 的标识列,填充第三个表的 select 语句返回两个 id_col 字段。

insert into tablethree 
select a.*, b.price, b.item, id_col 
from tableone a, tabletwo b 
where a.item = ....

当我们重组代码以便只返回一个 id_col 时……错误就停止了。

老实说,我同时修复了这个错误的另一个可能的原因。 在此之前还有另一个大型/长查询,该查询在 SQL Server 查询中使用 Foxpro Rushmore 语法(例如 a.item+a.customer = lc_item+lc_customer)。 我们以前遇到过此类问题,因此它可能是导致问题的一个因素......但证据高度支持额外的身份列是原因。

Just a follow-up on this question...with a partial solution.

I did run a trace, in fact a number of them. What I found, is that there appears to be multiple causes for these errors. I was able find and fix one of them, but we still get this error in other places, and they do not show up on the traces that I have done.

So what was the deal with the one I did find? Well, from the trace I found that these ODBC errors appeared after another SQL Server error:

Error: 1203, Severity: 20, State: 1.
Process ID 94 attempted to unlock a resource it does not own: OBJECT: 25:1699834390:0 . Retry the transaction, because this error may be caused by a timing condition. If the problem persists, contact the database administrator.

From the FoxPro code I found that an insert statement was causing this error... not always... but sometimes. In this insert, they were pulling all the fields from one table, and some of the fields from another table - into a third table. Every table in this database has an identity column called id_col, and the select statement that was populating the third table was returning two id_col fields.

insert into tablethree 
select a.*, b.price, b.item, id_col 
from tableone a, tabletwo b 
where a.item = ....

When we restructured the code so that only one id_col was being returned...the errors stopped.

To be honest there is one other possible contributor to this error that I fixed at the same time. There was another large/long query right before this one that was using Foxpro Rushmore syntax (e.g. a.item+a.customer = lc_item+lc_customer) in a sql server query. We have had issues with this type of thing before, so it could be a contributor to the problem... but the evidence is highly in favor of the extra identity column being the cause.

诗化ㄋ丶相逢 2024-07-19 11:03:05

不确定您是否遇到过完整的解决方案,但您是否研究过网络连接是否会中断?
对于使用笔记本电脑的用户来说,我正在开发的 VFP 程序之一开始频繁丢失 SQL 连接。 笔记本电脑似乎暂时失去了网络连接。 即使连接仅消失几秒钟,VFP 中的句柄也需要重置。 不确定这是否是您的确切问题,但听起来与我相似。

Not sure if you have come across a complete solution, but have you looked into whether the network connection ever gets interrupted?
One of the VFP programs I was developing started losing its SQL connection very frequently for users that were using laptops. It seemed that the laptops were temporary losing the network connection. Even if the connection is only gone for a couple seconds, the handle in VFP needs to be reset. Not sure if this is your exact issue, but sounded similar to me.

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