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/10 05:49:52 UTC
Invalid transaction state - held cursor requires same isolation
"Well, it is even harder for us, since we don't see the relevant part
of your code..."
Oh, I think you misunderstood me. You don't need to see my code to answer my question.
My question was:
"ANyone have any ideas what this message might mean?"
The message I am referring to is:
"Invalid transaction state - held cursor requires same isolation"
Why would you need my code to provide a simple elaboration on the meaning of
a rather cryptic message?
> 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
Re: Invalid transaction state - held cursor requires same isolation
Posted by Dy...@Sun.COM.
Dag.Wanvik@Sun.COM (Dag H. Wanvik) writes:
> Geoff hendrey <ge...@yahoo.com> writes:
>
>> "Well, it is even harder for us, since we don't see the relevant part
>> of your code..."
>>
>> Oh, I think you misunderstood me. You don't need to see my code to answer my question.
>>
>> My question was:
>>
>> "ANyone have any ideas what this message might mean?"
>>
>> The message I am referring to is:
>> "Invalid transaction state - held cursor requires same isolation"
>
> Your analysis is correct; it means that some result set for which
> holdability is true is still open when you try to change the isolation
> level.
>
> I think Dyre is trying to say that since we don't have access to your
> source code is it hard for others to determine if this is a Derby error
> or an error in your application code.
Yes, thanks for clarifying Dag. I should have been a bit more verbose,
I guess.
--
dt
Re: Invalid transaction state - held cursor requires same isolation
Posted by "Dag H. Wanvik" <Da...@Sun.COM>.
Geoff hendrey <ge...@yahoo.com> writes:
> "Well, it is even harder for us, since we don't see the relevant part
> of your code..."
>
> Oh, I think you misunderstood me. You don't need to see my code to answer my question.
>
> My question was:
>
> "ANyone have any ideas what this message might mean?"
>
> The message I am referring to is:
> "Invalid transaction state - held cursor requires same isolation"
Your analysis is correct; it means that some result set for which
holdability is true is still open when you try to change the isolation
level.
I think Dyre is trying to say that since we don't have access to your
source code is it hard for others to determine if this is a Derby error
or an error in your application code.
Are you able to produce a repro program showing the error? If so, this
will greatly aid in finding the problem.
Thanks,
Dag
>
> Why would you need my code to provide a simple elaboration on the meaning of
> a rather cryptic message?
>
>> 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