You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Veresh Jain <ve...@gmail.com> on 2010/10/29 01:51:45 UTC

java.lang.RuntimeException: java.sql.SQLException: ResultSet not open

Hi,

We are using Apache Derby latest version in our project and is getting error
"java.lang.RuntimeException: java.sql.SQLException: ResultSet not open.
Verify that autocommit is OFF."
Same SQL statement works properly with MySQL and Oracle but DErby it fails.

Please provide any pointers as what could be wrong.

Thanks a lot.

Regards
Veresh

Re: java.lang.RuntimeException: java.sql.SQLException: ResultSet not open

Posted by Bryan Pendleton <bp...@gmail.com>.
To turn autocommit off, call Connection.setAutoCommit(false); Here's some docs:
http://download.oracle.com/javase/1.4.2/docs/api/java/sql/Connection.html

If you don't turn autocommit off, you will indeed discover that the automatic
commit process can close various cursors and result sets at awkward times:
http://db.apache.org/derby/docs/10.6/devguide/cdevconcepts29416.html

You can gain a better understanding of the behavior of your application by
learning to read the derby.log logfile, and by learning to use the various
Derby trace flags, such as derby.language.logStatementText.

If you can post more details about the specifics of your situation, the
community will be able to give you more detailed suggestions.

thanks,

bryan

Re: java.lang.RuntimeException: java.sql.SQLException: ResultSet not open

Posted by "Dag H. Wanvik" <da...@oracle.com>.
Veresh Jain <ve...@gmail.com> writes:

Hi Veresh, this questions belongs on the Derby user's list. This list if
for development issue.

As to your question, the fact that other databases work, doesn't mean
Derby is wrong, please provide som more detail about what you are doing.

For example if you are using autocommit and have two open result sets in
that transaction, when the first one is drained it is automaticaly
closed leading the the transaction to commit as well, somewhat
surprisingly, perhaps. In such cases, run with autocommit off for best results.

Dag

> Hi,
>
> We are using Apache Derby latest version in our project and is getting error
> "java.lang.RuntimeException: java.sql.SQLException: ResultSet not open.
> Verify that autocommit is OFF."
> Same SQL statement works properly with MySQL and Oracle but DErby it fails.
>
> Please provide any pointers as what could be wrong.
>
> Thanks a lot.
>
> Regards
> Veresh

--