X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 184C59FB26A for ; Fri, 28 Jul 2006 12:58:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 56898-07 for ; Fri, 28 Jul 2006 12:58:04 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 7CD229FB266 for ; Fri, 28 Jul 2006 12:58:04 -0300 (ADT) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 28 Jul 2006 08:58:02 -0700 Subject: Re: Using ON_ERROR_ROLLBACK functionality in JDBC From: Mark Lewis To: Kris Jurka Cc: "Koth, Christian (DWBI)" , pgsql-jdbc@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Fri, 28 Jul 2006 08:58:01 -0700 Message-Id: <1154102281.1634.576.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.121 tagged_above=0 required=5 tests=AWL, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200607/96 X-Sequence-Number: 15522 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@postgresql.org so that your > message can get through to the mailing list cleanly