X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0309311F6C56 for ; Fri, 31 Mar 2006 13:43:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73003-08 for ; Fri, 31 Mar 2006 13:43:50 -0400 (AST) 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 ED58611F6850 for ; Fri, 31 Mar 2006 13:43:47 -0400 (AST) 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; 31 Mar 2006 09:43:45 -0800 Subject: Re: Behaviour of setAutoCommit may not be completely From: Mark Lewis To: Dave Cramer Cc: =?ISO-8859-1?Q?Jo=E3o?= Paulo Ribeiro , pgsql-jdbc@postgresql.org In-Reply-To: References: <442CFE4E.9000309@mobicomp.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Organization: MIR3, Inc. Date: Fri, 31 Mar 2006 09:43:45 -0800 Message-Id: <1143827025.5634.37.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-22) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.136 required=5 tests=[AWL=0.135, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.136 X-Spam-Level: X-Archive-Number: 200603/152 X-Sequence-Number: 14933 Just an FYI, I ran a quick compatibility test and Oracle's 10g driver does NOT commit if autoCommit was false and is set to false again. -- Mark Lewis On Fri, 2006-03-31 at 08:39 -0500, Dave Cramer wrote: > So the question is which document is right. >=20 > The specs as Michael pointed out say if it is called, the specs as =20 > Joao pointed out suggest that if it is changed. Joao, where did you =20 > read this ? >=20 > Dave > On 31-Mar-06, at 5:02 AM, Jo=C3=A3o Paulo Ribeiro wrote: >=20 > > Hello. > > > > I found a situation that is causing db locks using enhydra dods =20 > > with postgresql due to somethinf that look like a bad behaviour of =20 > > postgresql. > > Since version 6.0, i think, dods do all the db queries with =20 > > setAutoCommit(false). The expected behaviour of setAutocommit(...) =20 > > is that the current transaction is commited, allowing the db =20 > > backend to free resources previously allocated, and a new one is =20 > > created with the autocommit set to the value passed. > > > > From the specs: "If the value of auto-commit is changed in the =20 > > middle of a transaction, the current transaction is committed." > > > > The postgresql have a problem with setAutocommit(...): if the value =20 > > passed (false or true) is the same that was previously set, it just =20 > > does nothing. > > > > I looked to the postgresql driver and found this: > > > > public void setAutoCommit(boolean autoCommit) throws SQLException > > { > > if (this.autoCommit =3D=3D autoCommit) > > return ; > > if (autoCommit) > > { > > execSQL("end"); =09 > > } > > else > > { > > if (haveMinimumServerVersion("7.1")) > > { > > execSQL("begin;" + getIsolationLevelSQL()); > > } > > else > > { > > execSQL("begin"); > > execSQL(getIsolationLevelSQL()); > > } > > } > > this.autoCommit =3D autoCommit; > > } > > > > The driver do nothing when the value passed (false or true) is the =20 > > same > > that was previously set. > > I fixed the driver and found that the behaviour was the same: it's =20 > > look > > likes the backend is using the same logic and that explain why someone > > at the driver JDBC decided to not pass this to the backend. > > My tests were done with Postgresql 7.4.12. > > Can someone confirm that the problem exist and it is in the driver =20 > > code > > and the backend server? > > Is this still happening with postgresql 8.1? > > > > Best regards > > Jo=C3=A3o Paulo Ribeiro > > > > --=20 > > Jo=C3=A3o Paulo Ribeiro | Senior Software Engineer > > jp@mobicomp.com > > > > PHONE: + 351 253 305 250 > > FAX : + 351 253 305 250 > > www.mobicomp.com > > > > ________________________________________________________________ > > > > About Solutions | Wireless World > > > > CONFIDENTIALITY NOTICE: This message, as well as existing attached =20 > > files, is confidential and intended exclusively for the individual=20 > > (s) named as addressees. If you are not the intended recipient, you =20 > > are kindly requested not to make any use whatsoever of its contents =20 > > and to proceed to the destruction of the message, thereby notifying =20 > > the sender. > > DISCLAIMER: The sender of this message can not ensure the security =20 > > of its electronic transmission and consequently does not accept =20 > > liability for any fact which may interfere with the integrity of =20 > > its content. > > > > > > ---------------------------(end of =20 > > broadcast)--------------------------- > > TIP 5: don't forget to increase your free space map settings > > >=20 >=20 > ---------------------------(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