Subject | Re: ResultSet.next() throws GDS Exception: Cursor Unknown |
---|---|
Author | Roman Rokytskyy |
Post date | 2004-05-13T14:13:39Z |
Hi,
does not check) DatabaseMetaData.supportsOpenCursorsAcrossCommit() result.
fetching your data or to check the result of
DatabaseMetaData.supportsOpenCursorsAcrossCommit() and commit only
when the result is "true". Actually commit after doing a select is
needed only if you do a select from selectable procedure that modifies
database behind the scenes. In other cases commit will not help you.
Roman
> I was testing your JDBC driver with an Open Source Persistence LayerI suspected that. It seems that that persistence layer ignores (or
> package written by Artyom Rudoy that handles all the direct calls to
> the JDBC API. I finally figured out what was happening between the
> time the ResultSet is created and the next() method was called.
> Here is a simple test case that duplicates the error:
>
> ResultSet rs = pstmt.executeQuery();
> conn.commit();
> while(rs.next()) {
>
> The Persistence Layer determines if the JDBC driver supports
> transactions and turns off AutoCommit on the connection. It then
> calls commit() after each successfull transaction and rollback()
> after a failed transaction. It does this with Query transactions as
> well. Apparently the commit call to the JDBC driver invalidates the
> database cursor.
does not check) DatabaseMetaData.supportsOpenCursorsAcrossCommit() result.
> I am not sure what is the correct way to resolve this problem. ForYou should modify persistence layer by either doing commit after
> now I have disabled the transaction processing so that autocommit is
> never turned off. Should I modify the Persistence Layer to only
> call commit after an Update transaction or should the JDBC driver
> preserve the ResultSet after a call to commit()?
fetching your data or to check the result of
DatabaseMetaData.supportsOpenCursorsAcrossCommit() and commit only
when the result is "true". Actually commit after doing a select is
needed only if you do a select from selectable procedure that modifies
database behind the scenes. In other cases commit will not help you.
Roman