Sunday, March 11, 2012

Connection is busy with results for another hstmt

I have my java based application that works fine with SQL
server 6.5.
I upgraded DB to SQL Server 2000 and now the application
give me "Connection is busy with results for another
hstmt " ODBC error after I do couple of queries or updates
through the application.
Is it anything to do with ODBC drivers or I have to change
setup of SQL Server?
Thank you
Athar
SQL Server only supports a single active statement per connection. Are you
using the MS JDBC driver to access SQL Server?
If you aren't actually trying to use multiple statements per connection,
then you might be able to workaround the error by making sure the statement
is closed before using another one. I'm not familiar with the JDBC
interface, but in ODBC, you'd call SQLMoreResults() until it returned
SQL_NO_DATA to make sure you've processed all of the results on the wire.
In ADO.NET you will get the same error if you haven't called Close() or
Dispose() on the SqlDataReader before trying to Execute another SqlCommand
on the same SqlConnection.
If you are trying to use multiple statements per connection (at the same
time), then you need to use multiple connections instead.
SQL Server 2005 has a new feature called MARS (Multiple Active Result Sets)
which will allow multiple statements per connection.
Brannon
"Athar" <aikram@.celestica.com> wrote in message
news:185a01c47bdf$ee142e80$a601280a@.phx.gbl...
> I have my java based application that works fine with SQL
> server 6.5.
> I upgraded DB to SQL Server 2000 and now the application
> give me "Connection is busy with results for another
> hstmt " ODBC error after I do couple of queries or updates
> through the application.
> Is it anything to do with ODBC drivers or I have to change
> setup of SQL Server?
> Thank you
> Athar

No comments:

Post a Comment