Re: JDBC behaviour - Mailing list pgsql-jdbc

From John R Pierce
Subject Re: JDBC behaviour
Date
Msg-id 56C59D11.2070208@hogranch.com
Whole thread Raw
In response to Re: JDBC behaviour  (Sridhar N Bamandlapally <sridhar.bn1@gmail.com>)
Responses Re: JDBC behaviour  (Sridhar N Bamandlapally <sridhar.bn1@gmail.com>)
List 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



pgsql-jdbc by date:

Previous
From: Andreas Joseph Krogh
Date:
Subject: Re: JDBC behaviour
Next
From: Sridhar N Bamandlapally
Date:
Subject: Re: JDBC behaviour