This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Resultset getting closed. Resultset Already closed exception JZ0R0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Resultset getting closed. Resultset Already closed exception JZ0R0" Watch "Resultset getting closed. Resultset Already closed exception JZ0R0" New topic
Author

Resultset getting closed. Resultset Already closed exception JZ0R0

peter brews
Greenhorn

Joined: Feb 11, 2002
Posts: 20
We have a situation where we have to make recursive calls on a function. Here is the scenario
getMgrLvl( parameteres..........)
Resultset myResultset=null;
Open DB connection
get Resultset
while resultset.next() {
getMgrLvl
}
This code works fine but the problem as you see is it opens up lot of connections to the database beucase the same function is called and it opens up a connection. The code is modified to

Open up DB connectio
getMgrLvl( parameteres..........)
Resultset myResultset=null;
get Resultset
while resultset.next() {
getMgrLvl
}
this opens up the connection only once. But we get an errors Resultset already closed JZ0R0, beucase I think that the first result set is still open while the next result is initialised which in turn closes the first resultset. If there is only one row in the first result set this is fine but for multiple rows this seems to be a problem.
can u suggest any other way
Narendra Kamaraju
Greenhorn

Joined: Jul 18, 2001
Posts: 16
narendra.kamaraju@oracle.com
Hi Peter,
How many levels of nesting you do recursively here.If it is just confined to two levels,please use the following logic to overcome the exception that you are getting.I hope you are using JDBC2.0 compliant drivers to support the multiple cursors for a single connection.


Please let me know if it is doesn't work.
Cheers,
Narendra.
narendra.kamaraju@oracle.com


Narendra Kamaraju
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Resultset getting closed. Resultset Already closed exception JZ0R0
 
Similar Threads
JDBC Connections Freezing with Multiple Users Accessing DB
How do you get the complete count of records?
ResultSet closed error (URGENT !!)
Closing database connections properly?
ResultSet closed all the time