db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Noll <dan...@nuix.com.au>
Subject Strange error: "ResultSet not open. Operation 'next' not permitted."
Date Wed, 23 Nov 2005 22:32:43 GMT
Got this exception while two threads were rapidly querying a single 
database:

Caused by: SQL Exception: ResultSet not open. Operation 'next' not 
permitted. Verify that autocommit is OFF.
    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:195)
    at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:381)
    at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
    at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:1296)
    at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
    at 
org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:3715)
    at 
org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:385)
    at 
org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:299)
    ...

The code we called it from was checking for existence of a row, like this:

    PreparedStatement ps = conn.prepareStatement("SELECT ...");
    ps.setLong(1, id);
    ResultSet rs = ps.executeQuery;
    try
    {
        return rs.next();    <-- This line did it.
    }
    finally
    {
        rs.close();
    }

Autocommit is indeed off, but regardless of that, we're not actually 
updating this database at any point in time, just reading data out of it 
to put it in another.

Daniel

-- 
Daniel Noll

NUIX Pty Ltd
Level 8, 143 York Street, Sydney 2000
Phone: (02) 9283 9010
Fax:   (02) 9283 9020

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.


Mime
View raw message