Re: cursor "jdbc_curs_1" does not exist

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: cursor "jdbc_curs_1" does not exist
Дата
Msg-id 40D199CF.1050101@opencloud.com
обсуждение исходный текст
Ответ на Re: cursor "jdbc_curs_1" does not exist  (tmp@nitwit.de)
Ответы Re: cursor "jdbc_curs_1" does not exist  (tmp@nitwit.de)
Список 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 по дате отправления:

Предыдущее
От: tmp@nitwit.de
Дата:
Сообщение: Re: cursor "jdbc_curs_1" does not exist
Следующее
От: tmp@nitwit.de
Дата:
Сообщение: Re: cursor "jdbc_curs_1" does not exist