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 Geoff hendrey <ge...@yahoo.com> on 2007/10/06 02:22:40 UTC

Invalid transaction state - held cursor requires same isolation level

Here are 3 lines from my code:

Connection c = ConnectionManager.getConnection(req);
c.setAutoCommit(false);
c.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); 


The *second* time this block executes, I get this exception from the attempt to setTransactionIsolation:

java.sql.SQLException: Invalid transaction state - held cursor requires same isolation level
        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.Statement.executeUpdate(Unknown Source)
        at org.apache.derby.client.am.Connection.setTransactionIsolation(Unknown Source)
 

ANyone have any ideas what this message might mean? My guess is that a result set is open and a cursor in that result set is somehow not getting closed after the first pass. But I'm hard pressed to see where in my code this could be happening since I close all my connections in finally blocks.




Re: Invalid transaction state - held cursor requires same isolation level

Posted by Dy...@Sun.COM.
Geoff hendrey <ge...@yahoo.com> writes:

> Here are 3 lines from my code:
>
> Connection c = ConnectionManager.getConnection(req);
> c.setAutoCommit(false);
> c.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); 
>
>
> The *second* time this block executes, I get this exception from the attempt to setTransactionIsolation:
>
> java.sql.SQLException: Invalid transaction state - held cursor requires same isolation level
>         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.Statement.executeUpdate(Unknown Source)
>         at org.apache.derby.client.am.Connection.setTransactionIsolation(Unknown Source)
>  
>
> ANyone have any ideas what this message might mean? My guess is that a result set is open and a cursor in that result set is somehow not getting closed after the first pass. But I'm hard pressed to see where in my code this could be happening since I close all my connections in finally blocks.

Well, it is even harder for us, since we don't see the relevant part
of your code...

-- 
dt