Using ON_ERROR_ROLLBACK functionality in JDBC - Mailing list pgsql-jdbc

From Koth, Christian (DWBI)
Subject Using ON_ERROR_ROLLBACK functionality in JDBC
Date
Msg-id F5F602C218633C419C7BCA6CDDC6E90A02445678@COSSMGMBX04.EMAIL.CORP.TLD
Whole thread Raw
Responses Re: Using ON_ERROR_ROLLBACK functionality in JDBC
List 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


******************************************
The information contained in, or attached to, this e-mail, may contain confidential information and is intended solely
forthe use of the individual or entity to whom they are addressed and may be subject to legal privilege.  If you have
receivedthis e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your
systemand notify your system manager.  Please do not copy it for any purpose, or disclose its contents to any other
person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent
thoseof the company.  The recipient should check this e-mail and any attachments for the presence of viruses.  The
companyaccepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. 
******************************************

pgsql-jdbc by date:

Previous
From: "Peter Neu"
Date:
Subject: Best Way to handle duplicate key exceptions
Next
From: Kris Jurka
Date:
Subject: Re: Using ON_ERROR_ROLLBACK functionality in JDBC