Im trying to retrive some information using select query and then pass the result set to another program. While running i got the error saying that the resultset is closed and can not have access. so I cleaned any pstmt.close or con.close . But still it throws me the same error. Do you know where is the problem? Here i copy the SELEC and TRIGGER classes and the error.
Read this -
"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."
Joined: Jul 06, 2009
But I did'nt close any statement or connection and I did'nt re-execute it (you can check the code above!)
So remains third option "retriving next result from a sequence of multiple result". I searched many about this but I'm still confuse that a simple select does have a sequence of multiple result. I think no!
1) Am I right?
2) If Im right what is wrong then?
thank you so much!
Joined: Jul 11, 2008
Are you sure that something somewhere (your connection pool, for example) isn't executing
another query on the given statement? _Something_ is closing that result set, either it's
explicitly closed, or it's being closed by the fact that the statement has either had
another query executed on it, or the statement itself has been closed, either explicitly
or by the Connection that created it being closed.
See everytime you execute the statement, all open resultsets will be closed. There is no way around that.
So, you will have to read the entire resultset and save the results, then loop through those results, setting of the query again for the "next level down/up" and, once again, reading in the entire result set etc.
Else, you need to create a new statement object instead of PrepareStatement.
subject: problem in returning data using resultset