gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 09:26:45 25 4
gpt4 key购买 nike

我依稀记得在某处(在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com