pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John R Pierce <pierce@hogranch.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: JDBC behaviour
Date: Thu, 18 Feb 2016 02:29:37 -0800
Message-ID: <56C59D11.2070208@hogranch.com> (raw)
In-Reply-To: <CAGuFTBUm6833idGepWE9KBP87nYBuzHpTqwmf0981wCdS13K0w@mail.gmail.com>
References: <CAGuFTBXf_1Vws=Ja3nCqvRGvWPE2W4ATpCyxrreCgWFi0Yii=w@mail.gmail.com>
	<VisenaEmail.fd.a0847dd522e46d81.152f3b0448d@tc7-visena>
	<CAGuFTBXnVvX8cmbxF7HYhfrTQf9_pUTU=Lq2F4Niq-4jiObCzg@mail.gmail.com>
	<CAGuFTBUm6833idGepWE9KBP87nYBuzHpTqwmf0981wCdS13K0w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>



if you want each insert to work indepedently yet stay with the 
transaction model, then each insert should be its own transaction...


     conn.setAutoCommit(false);
     executeUpdate("insert into employee(id,name) values(1, 'K1')"); 
conn.commit();
     executeUpdate("insert into employee(id,name) values(1, 'K1')"); 
conn.commit();
     executeUpdate("insert into employee(id,name) values(1, 'K2')"); 
conn.commit();

otherwise the way you wrote it, its a single transaction.   all three 
inserts have to succeed, otherwise, all three are rolledback.    why is 
that so hard to understand?

-- 
john r pierce, recycling bits in santa cruz



-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (73+ messages)  latest in thread

Message-ID: <56C59D11.2070208@hogranch.com>
Permalink:  ../56C59D11.2070208@hogranch.com/
Also on:    postgresql.org/message-id/56C59D11.2070208@hogranch.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pierce@hogranch.com
  Subject: Re: JDBC behaviour
  In-Reply-To: <56C59D11.2070208@hogranch.com>
  References: <CAGuFTBXf_1Vws=Ja3nCqvRGvWPE2W4ATpCyxrreCgWFi0Yii=w@mail.gmail.com> <VisenaEmail.fd.a0847dd522e46d81.152f3b0448d@tc7-visena> <CAGuFTBXnVvX8cmbxF7HYhfrTQf9_pUTU=Lq2F4Niq-4jiObCzg@mail.gmail.com> <CAGuFTBUm6833idGepWE9KBP87nYBuzHpTqwmf0981wCdS13K0w@mail.gmail.com> <56C59D11.2070208@hogranch.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox