Dario V. Fassi wrote:
> I believe that this methods return wrong information.:
>
> DatabaseMetada.supportOpenCursorsAcrossCommit() return false /
> would return TRUE
> DatabaseMetada.supportOpenCursorsAcrossRollBack() return false /
> would return TRUE
>
> Code like this was user to say that.
>
> rs = executeQuery( ... );
> while ( rs.next() ) {
> con.rollback();
> con.commit();
> System.err.println( n++ ) ;
> }
>
> Count all the rows in the result set.
The metadata is correct -- the code you suggest above will fail if the
driver decides to use a resultset backed by a cursor. If it doesn't
decide to use a cursor, it'll work, but you can't rely on that behaviour
for all queries.
The right way to support this is to use JDBC3's holdable resultsets and
make the driver use a WITH HOLD cursor in that case.
It occurs to me that we can support holdable resultsets already by
disabling use of cursors when they are in use (along the lines of what
we do for scrollable resultsets) but I'm not convinced that's the best
thing to do -- better to implement proper cursor support instead.
-O