Re: cursor "jdbc_curs_1" does not exist - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: cursor "jdbc_curs_1" does not exist
Date
Msg-id 40D199CF.1050101@opencloud.com
Whole thread Raw
In response to Re: cursor "jdbc_curs_1" does not exist  (tmp@nitwit.de)
Responses Re: cursor "jdbc_curs_1" does not exist  (tmp@nitwit.de)
List pgsql-jdbc
tmp@nitwit.de wrote:

> And why doesn't this work:
>
> db.setAutoCommit(false);
>
> final Statement select =
> db.createStatement(ResultSet.HOLD_CURSORS_OVER_COMMIT,
> ResultSet.CONCUR_READ_ONLY);

You are passing the wrong constants here. The first argument to
createStatement should be the resultset type constant (ResultSet.TYPE_*)
not a cursor holdability constant.

You probably meant:

final Statement select = db.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);

The current driver will throw an exception if you try this, as
HOLD_CURSORS_OVER_COMMIT is not supported (actually, it throws in *all*
cases if you use the three-arg createStatement method -- I have that
fixed in my tree)

I note that the current driver returns true from
DatabaseMetadata.supportsResultSetHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT)
which is wrong.

-O

pgsql-jdbc by date:

Previous
From: tmp@nitwit.de
Date:
Subject: Re: cursor "jdbc_curs_1" does not exist
Next
From: tmp@nitwit.de
Date:
Subject: Re: cursor "jdbc_curs_1" does not exist