Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 0F1769FB219 for ; Fri, 29 Sep 2006 13:47:48 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 27164-01 for ; Fri, 29 Sep 2006 16:47:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with SMTP id A95249FB20C for ; Fri, 29 Sep 2006 13:47:42 -0300 (ADT) Received: (qmail 3069 invoked by uid 1112); 29 Sep 2006 16:47:41 -0000 Date: Fri, 29 Sep 2006 11:47:41 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: Sriram Dandapani cc: pgsql-jdbc@postgresql.org Subject: Re: jdbc batch insert In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF060E5BB1@ca-mail1.cis.local> Message-ID: References: <6992E470F12A444BB787B5C937B9D4DF060E5BB1@ca-mail1.cis.local> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200609/154 X-Sequence-Number: 15872 On Fri, 29 Sep 2006, Sriram Dandapani wrote: > I have a problem where the batch inserts behave as if the transactions > were done on a single row by single row basis. When I check the return > value of the batch update Transactions and affected row counts have nothing to do with each other. > int[] updateStatus = preparedStatement.executeBatch(); > > I get as many array entries as the number of rows inserted. > That's what the JDBC spec says you should get. Consider if your batches were instead "UPDATE TAB SET x= ? WHERE y = ?". Depending on your y value you would get a different number of updated rows, so you need one affected row count per batch entry. Kris Jurka