aspose file tools*
The moose likes JDBC and the fly likes Connection is busy with results for another hstmt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection is busy with results for another hstmt" Watch "Connection is busy with results for another hstmt" New topic
Author

Connection is busy with results for another hstmt

mat mat
Greenhorn

Joined: Oct 17, 2005
Posts: 1
Hi all,
i am using tomcat 4.12 and sql server 2000 in our project. i am getting Connection is busy with results for another hstmt exception. i am executing second query based on the first query result. once first query is executed then i had closed resultset and statement objects and reused result set and statement object n the second query. so i am doing same continuosuly.

My code:
boolean ff=false;
int i=0;
st= conn.createStatement();
rs=st.executeQuery("select name from emp");
while(rs.next())
{
i++;
}
if(i>0) ff=true;

if(!ff)
{
if(rs!=null){ rs.close(); rs=null; }
if(st!=null) { st.close(); st=null; }
st= conn.createStatement();
rs=st.executeQuery("select name from emp");
while(rs.next())
{
i++;
}
if(i>0) ff=true;
}

if(!ff)
{

code continues;;;;
}


what should i do

Thanks
pankaj patil
Ranch Hand

Joined: Dec 19, 2004
Posts: 98
try this

boolean ff=false;
int i=0;
st= conn.createStatement();
rs=st.executeQuery("select name from emp");
while(rs.next())
{
i++;
}
if(i>0) ff=true;

if(!ff)
{
rs=st.executeQuery("select name from emp");
while(rs.next())
{
i++;
}
if(i>0) ff=true;
}

if(!ff)
{

code continues;;;;
}


Regards,
Pankaj Patil
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29246
    
139

"Mat mat",
Welcome to JavaRanch!

We're pleased to have you here with us in the JDBC forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Please pick a last name that is different from your first name.

Thanks,
Jeanne
JDBC Forum Bartender


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection is busy with results for another hstmt
 
Similar Threads
Displaying a ResultSet Problem
Jdbc 2 Driver for DB2/UDB does not work
showing resultset
problem in accesing a db from a servlet
[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt