File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "database" Watch "database" New topic


Relu Ovidiu

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);
//i want to make another 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

Joined: Feb 05, 2001
Posts: 17271

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.

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") );//
wood burning stoves
subject: database
It's not a secret anymore!