Re: JDBC behaviour - Mailing list pgsql-jdbc

From John R Pierce
Subject Re: JDBC behaviour
Date
Msg-id 56C92E6A.3000209@hogranch.com
Whole thread Raw
In response to Re: JDBC behaviour  (Sridhar N Bamandlapally <sridhar.bn1@gmail.com>)
List pgsql-jdbc
On 2/20/2016 6:20 PM, Sridhar N Bamandlapally wrote:
> from Java/jdbc code, conn.setAutoCommit(false)
>
> insert into employee values(1, 'K1');
> insert into employee values(1, 'K1');
> insert into employee values(2, 'K2');
>
> by looking at exceptions i may rollback or commit, i.e.
> conn.rollback() or conn.commit()
> if I rollback table should be empty,
> if I commit table should have 2 rows
>
> is there any way is possible ?



turn on autocommit if you want each INSERT to be run atomically
independent of the other inserts.

this is going in circles, we've explained a dozens how postgres and jdbc
works.


--
john r pierce, recycling bits in santa cruz



pgsql-jdbc by date:

Previous
From: Sridhar N Bamandlapally
Date:
Subject: Re: JDBC behaviour
Next
From: Thomas Kellerer
Date:
Subject: Re: JDBC behaviour