Re: Connection Properties for FetchSize and Autocommit

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: David Langton <djlangton+pgjdbc(at)googlemail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Connection Properties for FetchSize and Autocommit
Date: 2009-10-11 22:16:56
Message-ID: 4AD25958.9010906@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

David Langton wrote:
>> David Langton wrote:
>>> defaultAutoCommit
>> That seems a pretty dangerous setting to have :/
>>
>> -O
>>
>
> I'm not sure! Without this parameter, you get a connection in
> autocommit mode anyway. If you actually set the mode yourself you get
> whatever it is you want. This parameter simply allows you to
> initially set autocommit to false in the url for those (rare)
> situations where it is what you want, but you can't modify the calling
> application.
>
> However, I'm certainly not any sort of JDBC expert, it just helped me
> out a lot to be able to do this (along with fetchsize) to avoid
> getting the whole result set sent to the driver all at once. If I
> could alter the application, I would have (and that would have been a
> better place to do it!).

The issue I see is that it can cause silent data loss. An application
that expects the documented API default - autocommit on - and just does
some UPDATEs is going to throw away all its changes if autocommit is
mysteriously off by default, because it's never going to call commit().

-O

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Langton 2009-10-12 16:35:21 Re: Connection Properties for FetchSize and Autocommit
Previous Message David Langton 2009-10-09 16:35:43 Re: Connection Properties for FetchSize and Autocommit