| From: | Michele Laghi <laghi(at)swissinfo(dot)org> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | transaction abortion | 
| Date: | 2003-09-16 18:03:25 | 
| Message-ID: | 3F67506D.30404@swissinfo.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Hi,
I am faced to the following problem:
...
conn.setAutoCommit(false);
String[] val = new String[] {"one", "two", "two", "three" };
for (int i=0; i < nmax; i++) {
    try {
       PreparedStatement
          pst = conn.prepareStatement("INSERT INTO ATEST VALUES (?)");
       pst.setString(1, val[i]);
       int ret = pst.executeUpdate();
    }
    catch (SQLException ex) { /* handle exception here */ }
}
conn.commit();
...
The inserted element is a primary key. What I want is to ignore the 
insertion of entries which are already in the DB. This works fine with 
Oracle and hsqldb but with Postgres the SQLException implicitly aborts 
the transaction. Is this behaviour correct or is it a bug ?
If it is correct, is there a way to inhibit the abortion of the 
transaction ? I am using v. 7.3.2 and as a driver jdbc7.2dev-1.2.jar
Regards
Michele
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vivek Khera | 2003-09-16 18:40:38 | Re: State of Beta 2 | 
| Previous Message | Christopher Browne | 2003-09-16 17:47:53 | Re: CONCAT function |