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 Record Set closing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Record Set closing" Watch "Record Set closing" New topic

Record Set closing

Tom Enders

Joined: Mar 27, 2010
Posts: 4
Why is my record set closed when I try to read from it the line after I execute the sql statement?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32819

Can you show the relevant code snippet?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Tom Enders

Joined: Mar 27, 2010
Posts: 4
Peter Johnson

Joined: May 14, 2008
Posts: 5852

What database and JDBC driver are you using?

If you comment out the ifClosed() check, what happens? Could it be that your query returns no results?

JBoss In Action
Tom Enders

Joined: Mar 27, 2010
Posts: 4
It's working now. The problem was with my inserts. They were not executing because I had some bad boolean logic surrounding them. So, the problem wasn't actually with this piece of code.
I agree. Here's the link:
subject: Record Set closing
It's not a secret anymore!