Re: How to fix error "Connection is busy with results for another hstmt"

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Vijay,

MS SQL Server, by default, only supports one Statement object per connection. This means that only one of your threads can submit a request.

Possible solutions are:

1. Create a server side cursor. This is typically done by putting "SelectMethod=cursor" in the connection string. When you define a server side cursor, SQL server will allow multiple statements per connection;


2. This is a better option. Create a connection pool in your application. When a thread needs a connection, it should get it from the pool and return it back when done.



If possible, avoid using SQL Server cursors. They generally use a lot of SQL Server resources and reduce the performance and scalability of your applications. If you need to perform row-by-row operations, try to find another method to perform the task.


Regards,
JE.





vijay singh wrote:
Platform: VS 2008, SQL Server 2005, OleDB



Hi,



I am using OleDB connection in vc++ code to insert data in sql server database. Single connection is being used by multiple threads to insert data. Sometime program is reporting error "Connection is busy with results for another hstmt".



Please help me how this issue can be resolved.



Thanks in advance,



Vijay


.



Relevant Pages

  • Re: Error "SQL Server does not allow remote connections"
    ... The application could not connect to the sql server db. ... network is blocking the connection. ... SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 ... integratedSecurity, SqlConnection owningObject) +737554 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Connection from remote computer to network SQL Server
    ... There is no firewall on the W2K machine acting as the SQL server. ... I tried making the SQL machine a "trusted" on the router. ... connection works. ... To find the IP address of your computer inside the network, ...
    (microsoft.public.access.adp.sqlserver)
  • ADO.net Orcas Samples Install Problem
    ... An error has occurred while establishing a connection to the server. ... When connecting to SQL Server 2005, this failure may be caused by the ... SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, ... or am I better off with a full SQL Server install. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: OpenDataSource SQL Server xpress problem
    ... I tried your suggestions with some success. ... I tried setting up the .odc file through the Word Mail Merge wizard as ... If I work through the dialog to connect and then click the 'Test Connection' ... but I suspect it's because until recently most SQL Server ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Exception trying to import data from Excel .
    ... An attempt to install Microsoft SQL Server 2005 this week has not gone ... The connection type "EXCEL" specified for connection manager ... to create a connection manager for an unknown connection type. ...
    (microsoft.public.sqlserver.tools)