Re: commit and rollback don't throw exceptions when they should

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: commit and rollback don't throw exceptions when they should
Дата
Msg-id 4ADF85C8.6040408@opencloud.com
обсуждение исходный текст
Ответ на Re: commit and rollback don't throw exceptions when they should  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: commit and rollback don't throw exceptions when they should
Список pgsql-jdbc
Kevin Grittner wrote:

> I need to go back and see if any earlier versions conflict with this,
> but recent version of the Java API specify that commit and rollback
> should throw a SQLException if autoCommit is true.  The driver
> currently returns without any warning or exception, and without doing
> anything.

Sounds reasonable.

> Java 6 also explicitly mentions that an exception should be
> thrown for attempts to use these methods on a closed connection,
> although that could arguably fall under the earlier language requiring
> an exception when "a database access error occurs" -- since you can't
> access a database across a closed connection.

Taking a quick look at the code, the driver should already throw an
exception on closed connection if any communication with the server is
actually needed (if autocommit is on or if no commands have been
executed in the current transaction, then it doesn't do any
communication and you won't get an exception). Putting an explicit check
for a closed connection wouldn't hurt.

-O

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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: commit and rollback don't throw exceptions when they should
Следующее
От: Steve Waldman
Дата:
Сообщение: deadlocks on JDBC batch inserts into tables with many columns