From: Oliver Jowett <oliver@opencloud.com>
To: Dario V. Fassi <software@sistemat.com.ar>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: DatabaseMetada.supportOpenCursorsAcrossCommit() return
Date: Sun, 18 Jul 2004 13:21:40 +1200
Message-ID: <40F9D0A4.2050401@opencloud.com> (raw)
In-Reply-To: <40F9C374.1040106@sistemat.com.ar>
References: <40F9C374.1040106@sistemat.com.ar>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, software@sistemat.com.ar
Subject: Re: DatabaseMetada.supportOpenCursorsAcrossCommit() return
In-Reply-To: <40F9D0A4.2050401@opencloud.com>
References: <40F9C374.1040106@sistemat.com.ar> <40F9D0A4.2050401@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox