From: Alexaki Sofia <alexaki(at)ics(dot)forth(dot)gr>
To: pgsql-interfaces(at)postgresql(dot)org
Cc: Alexaki Sofia <alexaki(at)ics(dot)forth(dot)gr>
Subject:
Date: 2000-12-09 14:09:53
Message-ID: Pine.GSO.4.10.10012091522000.24759-100000@athena.ics.forth.gr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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() commmand throws
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 code
con.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(
));
}
}

Browse pgsql-interfaces by date

  From Date Subject
Next Message Aziz ABI 2000-12-09 14:57:33
Previous Message Yves De Muyter 2000-12-09 14:04:00 JDBC Timestamp problem