| Author |
resultset is closed problem
|
deep raj
Ranch Hand
Joined: Dec 11, 2009
Posts: 186
|
|
rs=st.executeQuery(" "); //first query
while(rs.next())
{
rs1=st.executeQuery(" "); //second query
while(rs1.next())
{
}
}
in above way i write two queries in JSP Pageusing two different Resultset objects
but when i run the program
it shows
"OPERATION NOT ALLWED AFETR RESULTSET IS CLOSED"
now what can i do? how can i remove this problem?
|
 |
Nicola Garofalo
Ranch Hand
Joined: Apr 10, 2010
Posts: 308
|
|
Quoting from ResultSet documentation:
A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results.
http://java.sun.com/javase/6/docs/api/java/sql/ResultSet.html
Create a new Statement from the Connection to your database.
|
Bye,
Nicola
|
 |
deep raj
Ranch Hand
Joined: Dec 11, 2009
Posts: 186
|
|
in nested form
it is not used with different resultset and same statement
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2343
|
|
The spec says:
A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, ...
Your code does:
I think that your Statement object st is re-executed here, hence : ResultSet object is automatically closed.
|
OCUP UML fundamental
ITIL foundation
|
 |
 |
|
|
subject: resultset is closed problem
|
|
|