... - Mailing list pgsql-interfaces

From Alexaki Sofia
Subject ...
Date
Msg-id Pine.GSO.4.10.10012091522000.24759-100000@athena.ics.forth.gr
Whole thread Raw
List pgsql-interfaces
Hello,

I have created  a transaction consisting of several batch updates in
order to improve the performance(i.e. executeBatch() commands).I 'd expect (according to jdbc) when an executeBatch()
commmandthrows
 
an exception the transaction rolls back, that is updates the previous
executeBatch() commands containing in the transaction have incurred are
ignored. 

However I think in postgresql a batch update is considered to be a
transaction. This is incompatible with jdbc. 

Here is a part of the codecon.setAutoCommit(false);stmt.addBatch("CREATE TABLE  t1 (id int)");stmt.addBatch("CREATE
TABLE t2 (id int)");stmt.addBatch("CREATE TABLE  t3 (test int)");int [] updateCounts = stmt.executeBatch();
stmt.clearBatch();stmt.addBatch("CREATE TABLE  t4 (id int)");stmt.addBatch( "CREATE TABLE  t4 (id int)"); int []
updateCounts1= stmt.executeBatch();con.commit(); } catch(SQLException ex) con.rollback();
System.err.println("SQLException:" + ex.getMessage(
 
));
}
}




pgsql-interfaces by date:

Previous
From: Sylvain Barrette
Date:
Subject: RE: Error connecting to database
Next
From: "Aziz ABI"
Date:
Subject: