This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and Relational Databases and the fly likes Newbie needs help with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Newbie needs help with "Object has been closed" exception" Watch "Newbie needs help with "Object has been closed" exception" New topic

Newbie needs help with "Object has been closed" exception

Doug Slattery
Ranch Hand

Joined: Sep 15, 2007
Posts: 294
Aloha ranchers,

I'm starting to work with JDBC and MSSQL this week. This thread is related to this thread for those who are wondering...

With help from a co-worker, I have successfully setup a JNDI datasource in Tomcat. I've also been able to connect to the server and run a simple stored procedure. After turning up the heat a bit, I've ran into a problem and have searched for an answer, which has lead me here.

The Problem:
I'm trying to set up a simple stored procedure that will return a result set (empty is ok for now) of dummy values without accessing any tables. What I have seems to fly with SQL, but on the Java side, the result set is being closed somewhere.

Here's the SP:

And here's the Java code:

The last Java line (logger.debug...) shows "returnCode [00000] Query Timeout: [10]" as expected. However, if I inspect resultSet at that line (using the Sysdeo debugger), it shows the _res->closed property as true. Thus, when I get to the set iterator, an "Object has been closed" exception is thrown. I have been quick enough on the draw at times to see the _res->closed property set to false, but it never makes it to the iterator. Even with no break points set. I suspect there is a setting somewhere, perhaps a poolable(?) one that I don't know where to look for. Anyone have any ideas?


-- Nothing is impossible if I'mPossible
I agree. Here's the link:
subject: Newbie needs help with "Object has been closed" exception