Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A235E1337C3A for ; Wed, 6 Apr 2011 13:02:29 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 54891-04 for ; Wed, 6 Apr 2011 16:02:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from web33205.mail.mud.yahoo.com (web33205.mail.mud.yahoo.com [209.191.69.153]) by mail.postgresql.org (Postfix) with SMTP id 3B7511337C03 for ; Wed, 6 Apr 2011 13:02:08 -0300 (ADT) Received: (qmail 93525 invoked by uid 60001); 6 Apr 2011 16:02:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1302105727; bh=CD/LvXuawLze6YIkCeEs4ROP0Rr879yHAsmvyuYNr/8=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=VD+ELS9yGZfKeAvKPuUZptQzVcPSuj3ebVjlZWxKE/aJEa00xLaLwUO/m9/G+I5qMp1bFnaPrgdKfW4DmwxyHeLnq2Lp2KrjJEDKmdqyL0GY0igN5GGZxISjWiqu6F740494gn4EVD2u0L/dTJP4yPha9CMOhddHui84rPHgdCs= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=wByYt7TeaV7FdKD+tOnx+4ew7exPdkxKMGGO4+gGkfI6rKA2fYt+OiNlZSfIoRkc+CUAF8bE5fbgd/OPJXGjLlPlNL9VdXyr+zpQTvz/bp9CXX9UFvF0b0W5aDHuHhDxWrF7iQmCcb2dHwypzs6fljxeydkKuyWsGe+wtCucBqQ=; Message-ID: <638011.77546.qm@web33205.mail.mud.yahoo.com> X-YMail-OSG: MvjZhFkVM1mAh8M7MD3s5tdqsC3VRbA6xgFQT6.ZoPheYcm 0CikM4HmU4dPbt88r6.Pi7wORQTOxqNWGYwvteVXmzKcqWMwk7a0duH_uvY4 SjPWY56VAiFSUtySu_R3HHqZK3VPLY1TuFwK7yZjXwX.cVXXDK8fYzuh7syG RwNhJy33CjOpcNbZQLOiuyq1u1FKG9jZEDRzXIXjFQmdn2IdP9Iih6rjfNs. ZEBSq0ZTj5ej1osloVCdra0Fod6eyRnfU2LH_8pZZUmoKM_Sd58m7ju9NvDO pQLtd6Hgjstk9hwMR8wxJVW47wXScdU2AmTrDGsCbm9v9PlFcw0l0KMuhyPC 6I0UaawIy4iFu2aKMUSRLgqJqBJySFLSv8kyZwhqBDnxoMFU1IsbT_BU- Received: from [199.84.5.210] by web33205.mail.mud.yahoo.com via HTTP; Wed, 06 Apr 2011 09:02:07 PDT X-Mailer: YahooMailClassic/12.0.2 YahooMailWebService/0.8.109.295617 Date: Wed, 6 Apr 2011 09:02:07 -0700 (PDT) From: Quartz Subject: Re: JDBC gripe list (the autocommit subthread) To: "pgsql-jdbc@postgresql.org" In-Reply-To: <9BD8DE65-3EE5-491C-9814-B6E682C713CB@cha.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1143719359-1302105727=:77546" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.926 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_FONT_FACE_BAD=0.981, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RFC_ABUSE_POST=0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/37 X-Sequence-Number: 21763 --0-1143719359-1302105727=:77546 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Please don't refer to old docs/specs. I posted latest docs previously. --- On Thu, 3/31/11, Jeff Hubbach wrote: From: Jeff Hubbach Subject: Re: [JDBC] JDBC gripe list (the autocommit subthread) To: "pgsql-jdbc@postgresql.org" Received: Thursday, March 31, 2011, 6:02 PM On Mar 31, 2011, at 3:34 PM, Quartz wrote: Besides that's what release notes are for. And I dare say, if they expected= a transaction when using a batch with autocommit=3Dtrue, it about time the= y learn their mistake. JDBC api is a contract. Can't make exception for pos= tgres. Quartz, the problem is that behavior of batch updates when autocommit=3Dtru= e is not spec-defined, it's implementation-defined. Just because MySQL does= it one way doesn't make that the "right" way. Look at this post from 2009:= http://calmacs.org/blog/bogdan/2009/02/17/1234927980000.html"The behavior a= fter a failure is DBMS specific, as documented in=A0Statement.executeBatch(= ). Some unit tests I've run had shown that MSSQL continues with the rest of= the statements while Oracle aborts the batch immediately." And reading through the JDBC guide, albeit for an older version, here:http:= //download.oracle.com/javase/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.htmls= tates"For this reason, autocommit should always be turned off when batch up= dates are done. The commit behavior of=A0executeBatch=A0is always implement= ation defined when an error occurs and autocommit is true." And from the most recent JDBC tutorial, here:http://java.sun.com/developer/= Books/JDBCTutorial/index.html"To allow for correct error handling, you shou= ld always disable auto-commit mode before beginning a batch update." It seems to me that this is a case of you expecting behavior that is not sp= ec-defined, but because your prior experience with MySQL has taught you to = expect certain behavior, you expect that behavior to also be present in oth= er drivers even though the spec does not clearly state the expected behavio= r (it explicitly states that it's implementation-defined). This is clear in= the first post I linked to, where MSSQL continues (as does MySQL from your= admission), but Oracle aborts. -- Jeff Hubbach --0-1143719359-1302105727=:77546 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Please don't refer to old docs/specs.
I po= sted latest docs previously.



--- On Thu, 3/31/11, Jeff Hu= bbach <Jeff.Hubbach@cha.com> wrote:

From: Jeff Hubbach <Jeff.Hubbach@cha.com>
Subject: Re:= [JDBC] JDBC gripe list (the autocommit subthread)
To: "pgsql-jdbc@postg= resql.org" <pgsql-jdbc@postgresql.org>
Received: Thursday, March 3= 1, 2011, 6:02 PM

On Mar 31, 2011,= at 3:34 PM, Quartz wrote:


Besides that's what release notes ar= e for. And I dare say, if they expected a transaction when using a batch wi= th autocommit=3Dtrue, it about time they learn their mistake. JDBC api is a c= ontract. Can't make exception for postgres.


Quartz, the problem is that behavior of batch updates when autoco= mmit=3Dtrue is not spec-defined, it's implementation-defined. Just because = MySQL does it one way doesn't make that the "right" way. Look at this post = from 2009:
"The behavior after a failure is D= BMS specific, as documented in Stateme= nt.executeBatch(). Some unit tests I've run had shown that MSSQL continues wi= th the rest of the statements while Oracle aborts the batch immediately."
<= span class=3D"yiv890372884Apple-style-span" style=3D"font-size: 13px; line-= height: 19px;">
And reading through the JDBC guide, albeit f= or an older version, here:
states
"For this reason, autocommit should always be turned off when batch updates are done. The co= mmit behavior of executeBatch = ;is always implementation defined when an error occurs and autocommi= t is true."

And from the most recent JDBC tutorial,= here:
"To allow for correct err= or handling, you should always disable auto-commit mode before beginning a = batch update."

It seems to me that this is a case of you expecting be= havior that is not spec-defined, but because your prior experience with MyS= QL has taught you to expect certain behavior, you expect that behavior to a= lso be present in other drivers even though the spec does not clearly state= the expected behavior (it explicitly states that it's implementation-defined).= This is clear in the first post I linked to, where MSSQL continues (as doe= s MySQL from your admission), but Oracle aborts.

-- Jeff Hubbach
--0-1143719359-1302105727=:77546--