Driver transaction management (idle in transaction)

Поиск
Список
Период
Сортировка
От Steve Krulewitz
Тема Driver transaction management (idle in transaction)
Дата
Msg-id 4076F88F.6090601@mm.st
обсуждение исходный текст
Список pgsql-jdbc
Hey folks --

I am using the pg74.1jdbc3.jar driver against Postgresql 7.4.2 from
within Apache Cocoon, which uses connection pooling (provided by an
Apache Excalibur component).  I am running in autocommit false mode and
managing my own transactions with commit/rollback.

I am experiencing connections being left "idle in transaction" after a
web request is complete.  The problem is that when I call commit() on
the connection, the JDBC driver issues a "commit;begin;" to the server,
which puts the connection immediately back in a transaction.  This
usually wouldn't be a huge problem, but in a connection pooled
environment, the connection is never actually closed, and the connection
  will sit idle in transaction.

It seems to me that the driver should only issue a "begin" before the
next sql statement is executed, rather than right after the commit.  Or
maybe the begin could be removed all together and let the server
implicitly start the next transaction?

This problem was also just recently brought up on the hackers list:

http://archives.postgresql.org/pgsql-hackers/2004-04/msg00269.php

cheers,
-steve

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

Предыдущее
От: "--"
Дата:
Сообщение: Re: cannot connect to db from remote machine
Следующее
От: Alexander Staubo
Дата:
Сообщение: Re: Under what circumstances does PreparedStatement use stored