Connection is busy with results for another hstmt

Connection is busy with results for another hstmt

I wrote a JSP page to connect to a SQL database. I have about 3 connections for each result set. I receive the error "Connection is busy" with results for another hstmt. Sometimes I receive the error, sometimes I do not. I also would like to know if you have a method to close the database connection.

If you are using ODBC driver, I would recommend switching to a JDBC driver. The ODBC driver does not support multiple statements on a single connection. 

Basically, we allow multiple Statements (think of those are queries for example) to be run on a single Connection (we cache the connection, make it available to other apps/same app, etc.) 

You can download the MS JDBC driver from 

http://www.microsoft.com/downloads/details.aspx?familyid=07287b11-0502-461a-b138-2aa54bfdc03a&displaylang=en 

or another one that seems to work even better is http://jtds.sourceforge.net/ 

As far as closing the connection... Stoneware handles that for you. That is part of the connection caching that we supply. After a period of inactivity, we shut it down, handle the cleanup, etc. for you. This basically protects both the coder from having to do it, and the server from relying on the coder to do it. The connection is left available for other uses by the same app or other apps with the same connection settings.