Re: cursor "jdbc_curs_1" does not exist

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: tmp(at)nitwit(dot)de
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: cursor "jdbc_curs_1" does not exist
Date: 2004-06-17 13:17:03
Message-ID: 40D199CF.1050101@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

tmp(at)nitwit(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message tmp 2004-06-17 13:43:04 Re: cursor "jdbc_curs_1" does not exist
Previous Message tmp 2004-06-17 12:49:12 Re: cursor "jdbc_curs_1" does not exist