c - ODBC - 从一个应用程序到同一数据源的多个连接

标签 c windows odbc

我依稀记得在某处(在 MSDN ODBC 文档中?)读到一个应用程序不能与单个数据源建立多个连接。在我看来,我需要一个应用程序的所有线程都必须共享的连接。 我试图查找此信息,但我似乎无法再找到它。有谁知道/记得这是如何工作的?
这一切都可能成为我们应用程序的问题,因为它的一些线程将动态连接到他们选择的数据源。如果其中两个同时连接到一个源,我不想看到随机连接错误,所以我想仔细检查此信息。

最佳答案

也许您在 the MSDN documentation 中提到的声明, 是说只有一个 statement 可以在单个连接上激活的。它说:

Multiple Active Statements per Connection

After SQL Server has received a statement, the SQL Server TDS protocol does not allow acceptance of any other statements from that connection until one of the following occurs:

  • The client application processes the entire result set.
  • The client sends a statement telling the server it can close the remainder of the result set.

This means that when an ODBC application is using a default result set, SQL Server does not support multiple active statement handles on a connection handle and only one statement can be actively processed at any point in time.

When an ODBC application is using API server cursors, however, the driver can support multiple active statements on a connection. When the rowset for each cursor command has been received back at the client, SQL Server considers the statement to have completed, and it accepts another statement from another statement handle over that connection handle.

多连接没问题。每个连接有多个语句,不太好。

关于c - ODBC - 从一个应用程序到同一数据源的多个连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2731066/

相关文章:

c - 为什么即使我将.c文件作为参数提供,gcc仍无法识别我的.c文件?

C 预订问题

windows - 为什么从 Windows 批处理文件启动的 ffmpeg.exe 不等待用户输入就立即关闭?

postgresql - 如何配置 PostgreSQL ODBC 驱动程序

c - 这段代码有什么问题?我收到超出时间限制的错误。

c - 如何在Windows中确定文件是否存在、不存在或未知(使用c)

python - 错误 : Unable to find vcvarsall. bat

windows - 如何使用批处理命令在 hudson 中使构建失败

c++ - ODBC - 用 C++ 编写准备好的语句

mysql - Wordpress CMS 可以使用其他 DBMS 而不是 MySQL 吗?