Re: Using auto-commit OFF for transactions - instead of BEGIN

From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: Harry Mantheakis <harry(at)mantheakis(dot)freeserve(dot)co(dot)uk>
Cc: "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Using auto-commit OFF for transactions - instead of BEGIN
Date: 2004-03-08 14:08:47
Message-ID: 20040308140847.C10496@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


On 08/03/2004 11:40 Harry Mantheakis wrote:
> Hello
>
> I ported a relatively simple application using Oracle 8i with a JDBC
> client
> to PostgreSQL 7.4 with the same JDBC client, and everything just worked!
>
> One thing that did come to light was that PG offers a proprietary 'BEGIN'
> statement as a means of controlling transactions.
>
> With Oracle, I was used to setting auto-commit to false at the start of a
> transaction, and then calling commit or rollback at the end.
>
> Is it safe for me to continue setting auto-commit to false for
> transactions,
> and are there any compelling reasons - significant performance gains,
> perhaps - why I might want to consider adopting PG's 'BEGIN' statement
> instead?

Not only is it safe, it's the proper way to do it. FWIF, the driver
actually generates BEGIN and END commands under the covers and issueing
these yourself can potentially confuse it.

HTH

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message William Anthony Lim 2004-03-09 06:25:56 is nullable working?
Previous Message Kris Jurka 2004-03-08 13:31:42 Re: Using auto-commit OFF for transactions - instead of