

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
6 messages in org.postgresql.pgsql-jdbcRe: Using ON_ERROR_ROLLBACK functiona...| From | Sent On | Attachments |
|---|---|---|
| Koth, Christian (DWBI) | Jul 28, 2006 1:39 am | |
| Kris Jurka | Jul 28, 2006 1:56 am | |
| Koth, Christian (DWBI) | Jul 28, 2006 2:50 am | |
| Mark Lewis | Jul 28, 2006 8:57 am | |
| Kris Jurka | Jul 28, 2006 9:17 am | |
| Kris Jurka | Jul 28, 2006 9:23 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Using ON_ERROR_ROLLBACK functionality in JDBC | Actions... |
|---|---|---|
| From: | Koth, Christian (DWBI) (Chri...@smiths-heimann.com) | |
| Date: | Jul 28, 2006 2:50:49 am | |
| List: | org.postgresql.pgsql-jdbc | |
Kris, thanks for your answer. Find my comments below.
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)
The JDBC driver does not currently support this behaviour and if it did it would implement it using 2) behind the scenes, so that's a good approach.
Do you think its planned to do a thing like this?
Also I am wondering if this would really speed up applications. Is creating
savepoints expensive? Will have to do some tests. I think of doing something
like:
SAVEPOINT insert_savepoint; INSERT (... without error): SAVEPOINT insert_savepoint; (previous sp will be replaced?) (... with error): ROLLBACK TO SAVEPOINT insert_savepoint; INSERT SAVEPOINT insert_savepoint; ...
Also it's not clear what you mean by a batch, but the use of savepoints will not allow things like Statement.executeBatch() to commit parts of a batch. It's all or nothing for these.
By saying "my batch insert" I meant doing inserts without committing them each time. You are right that with using Statement.executeBatch() all statement within this batch will fail.
regards, Chris
******************************************
The information contained in, or attached to, this e-mail, may contain
confidential information and is intended solely for the use of the individual or
entity to whom they are addressed and may be subject to legal privilege. If you
have received this e-mail in error you should notify the sender immediately by
reply e-mail, delete the message from your system and 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 those of the company. The recipient
should check this e-mail and any attachments for the presence of viruses. The
company accepts no liability for any damage caused, directly or indirectly, by
any virus transmitted in this email.
******************************************







