By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

transaction abortion

P: n/a
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
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.