Skip site navigation (1) Skip section navigation (2)

Re: Using ON_ERROR_ROLLBACK functionality in JDBC

From: Mark Lewis <mark(dot)lewis(at)mir3(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: "Koth, Christian (DWBI)" <Christian(dot)Koth(at)smiths-heimann(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Using ON_ERROR_ROLLBACK functionality in JDBC
Date: 2006-07-28 15:58:01
Message-ID: 1154102281.1634.576.camel@archimedes (view raw or flat)
Thread:
Lists: pgsql-jdbc
Does the current savepoint implementation in the driver require a
separate round-trip?

-- Mark Lewis

On Fri, 2006-07-28 at 03:57 -0500, Kris Jurka wrote:
> 
> On Fri, 28 Jul 2006, Koth, Christian (DWBI) wrote:
> 
> > 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?
> 
> The JDBC driver does not currently support this behavior and if it did it 
> would implement it using 2) behind the scenes, so that's a good approach.
> 
> 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.
> 
> Kris Jurka
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>        message can get through to the mailing list cleanly

In response to

Responses

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2006-07-28 16:17:54
Subject: Re: Using ON_ERROR_ROLLBACK functionality in JDBC
Previous:From: Koth, Christian (DWBI)Date: 2006-07-28 09:51:12
Subject: Re: Using ON_ERROR_ROLLBACK functionality in JDBC

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group