473,382 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

ODBC Connection busy error

I am having multiple threads in my c program to execute same procedure
with differnt parameter values every time.
I have created different functions to execute the same.
However when SQLExecute is run on one of the thread it returns an
error saying
[Microsoft][ODBC SQL Server Driver]Connection is busy with results for
another hstmt
How do I call the same stored procedure on different threads to
execute at the same time.
Jul 20 '05 #1
2 2931
Use a different connection for each thread. I believe the problem is that
your SQL statements probably returns a result set and you are trying to use
the same connection to return multiple result sets.

"vishal" <vi**************@mentorix.com> wrote in message
news:f1**************************@posting.google.c om...
I am having multiple threads in my c program to execute same procedure
with differnt parameter values every time.
I have created different functions to execute the same.
However when SQLExecute is run on one of the thread it returns an
error saying
[Microsoft][ODBC SQL Server Driver]Connection is busy with results for
another hstmt
How do I call the same stored procedure on different threads to
execute at the same time.

Jul 20 '05 #2
[posted and mailed, please reply in news]

vishal (vi**************@mentorix.com) writes:
I am having multiple threads in my c program to execute same procedure
with differnt parameter values every time.
I have created different functions to execute the same.
However when SQLExecute is run on one of the thread it returns an
error saying
[Microsoft][ODBC SQL Server Driver]Connection is busy with results for
another hstmt
How do I call the same stored procedure on different threads to
execute at the same time.


It has nothing to do with that you are calling the same procedure in
different threads. It has to do with that you are trying to use the
same connection for simulataneous requests.

The most common reason for this error is a failure to get all rows and
result sets from the server. This could be because you have not anticipated
extra result sets generated by "rows affected" messages. These messages can
be turned off with SET NOCOUNT ON, and this is usually a good practice to
do, because it improves performance. (Of course, sometimes you need these
messages, in which case you should keep NOCOUNT off.)

If you are accessing SQL Server from separate threads, each thread should
probably have its own connection. If not, the connection is a common
resource, and the threads must use a semaphore or some other locking
mechanism, to be able to access the common resource.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
0
by: Bob | last post by:
I have an ASP.NET web application that has been running without any problems for a while. I recently transferred the site to shared hosting and had multiple users start to use the site. The problem...
4
by: Dave | last post by:
Hey guys, I have an ODBC problem that has me stumped. I wrote a VBA script to run in Microsoft Excel that pulls data out of an application using that application's ODBC driver and puts it into...
7
by: HB | last post by:
Guys, How to use ODBC with a DB connection in ASP.NET? each time I try to add the ODBC name in the connection an error telling that it is not compatible (or so) to use ODBC. I have .NET 2002...
1
by: Jordi | last post by:
Hi, I have a problem when accesing data with and ODBC provider under asp.Net applications. The question is that if I run the application in the same server where data is stored then data is...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
3
by: Greg Strong | last post by:
Hello All, Is there any way to close an ODBC connection via DSN without completely closing the Access front-end? I'm doing some testing with using Access as a front-end to Oracle 10g Express...
8
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
3
by: zombiechewtoy | last post by:
I'm having trouble making an ODBC connection using VB.NET 2005. I have tried nearly every connection string found on connectionstrings.com, in almost every format I can think of. I have tried...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.