471,354 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

transaction abortion

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
0 966

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by TZoner | last post: by
3 posts views Thread by Thiko | last post: by
1 post views Thread by Avanish Pandey | last post: by
36 posts views Thread by Rolloffle | last post: by
15 posts views Thread by Zeng | last post: by
1 post views Thread by Matik | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.