Subject Re: Strange error message: "Cursor"?!?
Author DATACOM - Diego
Hi people, I have discovered how to reproduce my problem:

1. Open a JDBC connection to Firebird 1.5.2.4731 using JayBird
1.5.5JDK_1.4 as driver (have not tried with 2.0 yet);
2. Set autoCommit to false;
3. Execute a query wich returns a ResultSet with some rows (say 5 rows);
4. Start iterating over the ResultSet using ResultSet.next();
5. On each iteration, execute an update using the same connection (say
an insert on some arbitrary table) and commit the changes
(Connection.commit());
6. Just before the last iteration, the call to ResultSet.next() will
generate an exception with the stack trace I reported before (see below).

Is there anything wrong with these steps? Is it forbidden to call
commit() while traversing a ResultSet? This issue is related to JayBird
or to some characteristic of JDBC/JCA? Below is the stack trace.

Regards,
Diego

Exception in thread "main" org.firebirdsql.jdbc.FBSQLException: GDS
Exception. 335544569. Dynamic SQL Error
SQL error code = -504
Cursor
at
org.firebirdsql.jdbc.FBStatementFetcher.fetch(FBStatementFetcher.java:198)
at
org.firebirdsql.jdbc.FBStatementFetcher.next(FBStatementFetcher.java:127)
at org.firebirdsql.jdbc.FBResultSet.next(FBResultSet.java:223)
at dmview.common.Teste.main(Teste.java:24)
at org.firebirdsql.gds.GDSException: Dynamic SQL Error
SQL error code = -504
Cursor
at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1816)
at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1769)
at org.firebirdsql.jgds.GDS_Impl.isc_dsql_fetch(GDS_Impl.java:1106)
at
org.firebirdsql.jca.FBManagedConnection.fetch(FBManagedConnection.java:828)
at
org.firebirdsql.jdbc.AbstractConnection.fetch(AbstractConnection.java:969)
at
org.firebirdsql.jdbc.FBStatementFetcher.fetch(FBStatementFetcher.java:192)
at
org.firebirdsql.jdbc.FBStatementFetcher.next(FBStatementFetcher.java:127)
at org.firebirdsql.jdbc.FBResultSet.next(FBResultSet.java:223)
at dmview.common.Teste.main(Teste.java:24)

> Message: 2
> Date: Tue, 22 Nov 2005 21:32:51 +0100
> From: "Roman Rokytskyy" <rrokytskyy@...>
> Subject: Re: Re: Strange error message: "Cursor"?!?
>
> Hi Diego,
>
>
>>By now, all I can say about it is
>>that it occurs in a database intensive thread in wich a bunch of queries
>>is performed followed by some inserts. Apparently the error is taking
>>place in one of the queries.
>
>
> Try upgrading to JayBird 2.0.0, the old one had some issues in multithreaded
> applications accessing the same connection (though that was more JCA issue),
> the new one should work ok now.
>
> Otherwise I have no idea what this can be...
>
> Roman