I'm getting a Connection Busy With Results From Another Command
error from a SQLServer Native Client driver when a SSIS package is running. Only when talking to SQLServer 2000. A different part that talks to SQLServer 2005 seems to always run fine. Any thoughts?
问题:
回答1:
Microsoft KB article 822668 is relevant here:
FIX: "Connection is busy with results for another command" error message occurs when you run a linked server query
Symptoms
Under stress conditions, you may receive the following error message when you perform linked server activity:
Server: Msg 7399, Level 16, State 1, Procedure <storedProcedureName>, Line 18 OLE DB provider 'SQLOLEDB' reported an error. OLE/DB Provider 'SQLOLEDB' ::GetSchemaLock returned 0x80004005: OLE DB provider SQLOLEDB supported the Schema Lock interface, but returned 0x80004005 for GetSchemaLock .]. OLE/DB provider returned message: Connection is busy with results for another command OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ::CreateSession returned 0x80004005.
Note The OLE DB source of the error may vary. However, all variations of the error message include the text "Connection is busy with results for another command".
Resolution
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000.
As noted there, the problem was first corrected in SQL Server 2000 Service Pack 4.
This blog post by Mark Meyerovich, a Senior Software Engineer at RDA Corp, also provides some insight (now archived, because the original link went dead):
SQL Server service pack upgrade
A quick search on Google turns up the following article (http://support.microsoft.com/kb/822668): FIX: "Connection is busy with results for another command" error message occurs when you run a linked server query.
It basically implies the issue is a bug and recommends an upgrade to Service Pack 4. We have started out with SQL Server 2000 SP3 and we do have some linked servers in the equation, so we give it a try. After the upgrade to SP4 – same result.
回答2:
As I just found out, this can also happen on SQL 2005 if you do not have MARS enabled. I never even knew that it was disabled by default, but it is. And make sure you are using the "NATIVE OLEDB\SQL Native Client" connection type. If you're using the "OLEDB.1" type connection (or whatever...) MARS is not even an option, and you get the SQL 2000 behavior, which is nasty.
You can enable MARS by opening the connection properties, and clicking "All", and scolling down in Management Studio.
I know your question has long since been answered, but I'm just throwing this in for the next sucker like me who gets burned by this.
回答3:
Had this error today with MS ODBC Driver 11 for SQL Server for Linux to SQL Server connection. Wanted to help next searcher considering this was the first Google search result when I made the search.
You need to set MARS_Connection in /etc/odbc.ini as following:
[ConnName]
Driver=ODBC Driver 11 for SQL Server
Server=192.168.2.218,1433
Database=DBNameHere
MARS_Connection=yes
Speaking of MS ODBC Linux Driver: It is a complete PITA to deal with it but I insisted using native solution. I experienced too many walls especially working with ZF2, however, every trouble has a solution with the driver I can say. Just to encourage people using it instead quickly give up.
回答4:
If somebody met this annoying bug while using PHP PDO with ODBC, then use closeCursor()
method after query execution.
回答5:
Just for information if somebody else have the problem. I tried connecting via NetCobol of Fujitsu on an SQLEXPRESS via ODBC with embedded sql and to solve the problem I had to change a value in the registry namely
\HKLM\Software\ODBC\ODBC.INI\MyDSN
with MyDSN as a string value:
Name - MARS_Connection
Value - Yes
I just put the information here if it can help.