| 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: 26184
|
|
"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
|
 |
 |
|
|
subject: Connection is busy with results for another hstmt
|
|
|