This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Resultset not Open? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Resultset not Open?" Watch "Resultset not Open?" New topic
Author

Resultset not Open?

Qaiser Mehmood
Greenhorn

Joined: Jan 10, 2011
Posts: 9
I get following error on Result set
java.sql.SQLException: ResultSet not open. Verify that autocommit is OFF.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.ResultSet.next(Unknown Source)

Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2477
    
    7

You close the connection in your finally block. This will also close the ResultSet 'res' that you return.


OCUP UML fundamental and ITIL foundation
youtube channel
Qaiser Mehmood
Greenhorn

Joined: Jan 10, 2011
Posts: 9
Reultset res is outside finaly block.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Qaiser Mehmood wrote:Reultset res is outside finaly block.


Not sure what you mean by that, but Jan is right. Your method returns a ResultSet that is closed, because you closed it in your finally block (by closing the connection).


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Resultset not Open?
 
Similar Threads
connectio null problem
Setting Location for database to be used by javadb
405 error
how to get the next sequence number ..
help me! stateful session bean problem