...
От | Alexaki Sofia |
---|---|
Тема | ... |
Дата | |
Msg-id | Pine.GSO.4.10.10012091522000.24759-100000@athena.ics.forth.gr обсуждение исходный текст |
Список | 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 по дате отправления: