Re: Bug: Transaction still open after error when autocommit=true

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Bug: Transaction still open after error when autocommit=true
Дата
Msg-id CA+0W9LM4sPezbSQ2t1RukzFFapksLyJsqYw0aw-Z16SOd92tqA@mail.gmail.com
обсуждение исходный текст
Ответ на Bug: Transaction still open after error when autocommit=true  (Daniel Migowski <dmigowski@ikoffice.de>)
Список pgsql-jdbc
On 23 December 2011 10:09, Daniel Migowski <dmigowski@ikoffice.de> wrote:

> If I send a statement with a BEGIN token

Don't do that; the driver is expecting you to manage transaction
demarcation by using JDBC's autocommit setting and commit/rollback,
not by sending explicit SQL. (Kevin pointed out the relevant JDBC
javadoc that covers this in his reply)

If you must send a raw BEGIN for some reason, then you're also
responsible for transaction cleanup yourself (i.e. don't expect
commit() or rollback() to work; you must send appropriate SQL yourself
to commit or rollback the transaction)

The driver's implementation of autocommit boils down to "if autocommit
is off and the connection does not have an active transaction, then
send BEGIN before the next query". When autocommit is on, the driver
just assumes the server's default behavior - i.e. autocommit happens
without any special intervention. If you send an explicit transaction
demarcation commands, you'll confuse that.

Oliver

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Bug: Transaction still open after error when autocommit=true
Следующее
От: Magosányi Árpád
Дата:
Сообщение: Datasource portNumber property