aspose file tools*
The moose likes JDBC and the fly likes database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "database" Watch "database" New topic
Author

database

Relu Ovidiu
Greenhorn

Joined: Mar 18, 2004
Posts: 12
I recive this error: " java.sql.SQLException: Operation not allowed after ResultSet closed " when i'm using this code:

----------------
....
String query="select * from table1";
ResultSet rs = stmt.executeQuery(query);
while(rs.next())
{
//i want to make another select...how can a do that?
query="select * from table2 where id_us2=" +rs.getInt("id_u");

ResultSet rs1=stmt.executeQuery(query);//here i recive the error
out.println( rs1.getInt("id_us2") );//
}
.....
So, how can i resolve the problem?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Moving to JDBC forum.
This forum is for Servlets questions.
Also you are using the same statement object that you used in the first place, maybe you need to create another statement object. But his is a guess.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Gowrishankar Mudaliar
Ranch Hand

Joined: Oct 20, 2001
Posts: 39
try to have another statement and try this.
ResultSet rs1=new_statement.executeQuery(query);//here i recive the error
out.println( rs1.getInt("id_us2") );//
 
jQuery in Action, 2nd edition
 
subject: database
 
Similar Threads
How can i continue executing other SQL Statments , even if one of them fails
intersolv JDBC driver for DB2 on OS/390
prepared statement with "in" predicate
help connecting to mysql database
Resultset