执行 SQLFreeHandle 后 ODBC 何时关闭连接?

发布于 2024-10-05 05:47:26 字数 330 浏览 0 评论 0原文

这个问题与这个相关< /a>.

我遇到的问题是我们的应用程序有一个错误,它在 SQL 中留下了未关闭的事务。我确信连接已通过 SQLFreeHandle 释放,但看起来 ODBC 以某种方式保持连接打开以便稍后重用它。由于连接保持打开状态,事务不会回滚,并且我有锁。

有没有办法强制 ODBC 关闭连接并关闭底层套接字?

提前致谢。

this question is related with this one.

The problem I'm having is that our application has a bug and it leaves an unclosed transaction at SQL. I know for sure that the connection has been released with SQLFreeHandle but looks like somehow ODBC maintains the connection open to reuse it latter. As the connection remains open the transaction is not rolled back and I'm having a lock.

Is there a way to force ODBC to shutdown the connection and to close the underlying socket?

Thanks in advance.

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

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

发布评论

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

评论(2

洛阳烟雨空心柳 2024-10-12 05:47:26

听起来连接池已打开。 本文介绍了如何在驱动程序级别将其关闭。

It sounds like connection pooling is turned on. This article describes how it can be turned off at the driver level.

小猫一只 2024-10-12 05:47:26

正如 Mark 所说,连接池已打开。

通常,sql 驱动程序的包装器会在将连接释放回池之前进行回滚调用。

如果你们编写了自己的 ODBC 驱动程序(或其包装器),您可能会考虑修改连接处置/关闭/释放代码以在存在打开的事务时执行回滚。

As Mark said, connection pooling is turned on.

Typically the wrappers for the sql drivers make a rollback call prior to releasing the connection back to the pool.

If you guys have written your own ODBC driver (or wrapper for it), you might consider just modifying the connection dispose/close/release code to do that rollback if there was an open transaction.

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