Re: Jdbc3PoolingDataSource default auto commit is false

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: Jdbc3PoolingDataSource default auto commit is false
Дата
Msg-id 1049360110.18440.8.camel@coppola.ecircle.de
обсуждение исходный текст
Ответ на Jdbc3PoolingDataSource default auto commit is false  (Ryan Christianson <ryan@echospace.com>)
Ответы Re: Jdbc3PoolingDataSource default auto commit is false  (Ryan Christianson <ryan@echospace.com>)
Список pgsql-jdbc
You still could have set the autocommit flag on a per connection basis.
The default autocommit is the autocommit value a newly checked out
connection will have, but you can set it to on after checking out the
connection from the pool.
And yes, when autocommit is off, you need to commit/rollback after your
queries.
BTW, I find the autocommit being off by default as rather useless and
confusing, as people will know how to explicitly open a transaction when
they want to have one wrapping more queries, and queries not explicitly
wrapped in transactions are usually to be committed immediately. It is
confusing, as your case clearly demonstrates.

HTH,
Csaba.

On Wed, 2003-04-02 at 19:55, Ryan Christianson wrote:
> Hi.
>
> I am useing Jdbc3PoolingDataSource to do database pooling. When I first
> started using it some of my updates where not taking effect. So I
> started enabled postgres logging and watched my queries, and I found out
> why. The Jdbc3PoolingDataSource by default sets setDefaultAutoCommit to
> false, and because of that, after every query it was calling "rollback".
>
> To fix it, I extended Jdbc3PoolingDataSource, over-wrote the
> createConnectionPool like so:
>     protected ConnectionPool createConnectionPool() {
>         ConnectionPool pool = super.createConnectionPool();
>         pool.setDefaultAutoCommit(true);
>         return pool;
>     }
>
> So my question is, how should I have worked with defaultAutoCommit set
> to true? Would I need to wrap all of my queries in begin; and commit; ?
>
> Thanks
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


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

Предыдущее
От: Joseph Shraibman
Дата:
Сообщение: Re: SQLException : Unknown Response Type
Следующее
От: apratim sharma
Дата:
Сообщение: abstract method error while using rs.beforeFirst() ???