6 messages in org.postgresql.pgsql-jdbcUsing ON_ERROR_ROLLBACK functionality...
FromSent OnAttachments
Koth, Christian (DWBI)Jul 28, 2006 1:39 am 
Kris JurkaJul 28, 2006 1:56 am 
Koth, Christian (DWBI)Jul 28, 2006 2:50 am 
Mark LewisJul 28, 2006 8:57 am 
Kris JurkaJul 28, 2006 9:17 am 
Kris JurkaJul 28, 2006 9:23 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Using ON_ERROR_ROLLBACK functionality in JDBCActions...
From:Koth, Christian (DWBI) (Chri@smiths-heimann.com)
Date:Jul 28, 2006 1:39:32 am
List:org.postgresql.pgsql-jdbc

Hi all,

I have seen psql has implemented a variable called ON_ERROR_ROLLBACK. "When on, if a statement in a transaction block generates an error, the error is ignored and the transaction continues." (from the documentation).

I would need the same functionality using JDBC. So I could continue with my
batch insert even if one or more statements fail. Right now I'm committing the
transaction after each insert.

I have thought of the following:

1. Checking constraints before calling insert. (to slow) 2. Creating a user defined savepoint before each insert, and rolling back to this savepoint if the insert fails. (not tried yet)

What would you recommend? Is it possible to set ON_ERROR_ROLLBACK for JDBC
transactions? AFAIK other DBMS do let you continue with you transaction if there was in error.

Thanks, Chris