Re: executeBatch() and operation after error

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Heiko W(dot)Rupp <heiko(dot)rupp(at)redhat(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: executeBatch() and operation after error
Date: 2007-01-15 12:24:31
Message-ID: 55C00BEC-5B33-4358-875E-51A34D217071@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


On 15-Jan-07, at 6:13 AM, Heiko W.Rupp wrote:

> Hi,
>
> JDBC 3.0 spec speifies that in 15.1.3 a driver may continue
> processing statements in a batch
> if one of the statements throws an error.
>
> Is this supported by the current driver? If yes, how can I enable
> this?
A cursory examination of the code suggests not.
>
> I have a use case where most of the time my application would very
> much benefit from
> using batches, but where sometimes the data to be inserted is
> already there.
>
> Of course there is the workaround to check for a BatchException and
> then doing a
> getUpdateCounts() to fall back inserting everyhing 'by hand'. But
> obviously it is desirable
> for e.g. a batch of 10 to only process statement #2 if this is
> failing and having all other
> statements be treated by the batching

Given the semantics of postgresql transactions this would be onerous
to implement. If a single statement fails in a transaction subsequent
statements fail.

Dave
>
> Heiko
>
>
> --
> Heiko W.Rupp
> heiko(dot)rupp(at)redhat(dot)com, http://www.dpunkt.de/buch/3-89864-429-4.html
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Havard Tveite 2007-01-15 13:11:12 "nested transaction" - encosing statement gets closed when the enclosed statement is closed
Previous Message Heiko W.Rupp 2007-01-15 11:13:07 executeBatch() and operation after error