From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: strange commit behavior |
Date: | 2008-11-18 09:34:05 |
Message-ID: | gfu26d$eq5$1@ger.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Flavio Palumbo, 18.11.2008 10:01:
> I tested this tool under MySql and Oracle and everything went as expected.
>
> Unfortunately postgres seems to work in a different way, cause if there is
> just one error while the transaction is active I'm not able to commit the
> well formed data in the db, no matter if the good records were inserted
> sooner or later the error.
>
> Does this behavior appears right for postgres ?
Yes this is the way Postgres works (been there as well)
> There is any way or workaround to achieve my goal ?
You need to wrap each UPDATE/INSERT statement with a Savepoint
Savepoint sp = connection.setSavepoint()
try
{
// do your insert/update/delete here
connection.release(sp);
}
catch (SQLException sql)
{
connection.rollback(sp);
}
Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2008-11-18 09:36:53 | Re: Commit strange behavior |
Previous Message | Flavio Palumbo | 2008-11-18 09:15:03 | Commit strange behavior |