From: | John R Pierce <pierce(at)hogranch(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: JDBC behaviour |
Date: | 2016-02-18 10:29:37 |
Message-ID: | 56C59D11.2070208@hogranch.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers pgsql-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
From | Date | Subject | |
---|---|---|---|
Next Message | Victor Blomqvist | 2016-02-18 10:32:49 | Re: Query plan not updated after dropped index |
Previous Message | Andreas Joseph Krogh | 2016-02-18 10:22:13 | Re: JDBC behaviour |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2016-02-18 10:31:08 | Re: checkpointer continuous flushing - V16 |
Previous Message | Andreas Joseph Krogh | 2016-02-18 10:22:13 | Re: JDBC behaviour |
From | Date | Subject | |
---|---|---|---|
Next Message | Sridhar N Bamandlapally | 2016-02-18 10:43:36 | Re: JDBC behaviour |
Previous Message | Andreas Joseph Krogh | 2016-02-18 10:22:13 | Re: JDBC behaviour |