X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C7B4B9F9D99 for ; Mon, 22 May 2006 17:14:27 -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 25047-03 for ; Mon, 22 May 2006 17:14:17 -0300 (ADT) 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 E59C99F9B01 for ; Mon, 22 May 2006 17:14:16 -0300 (ADT) Received: (qmail 3826 invoked by uid 1112); 22 May 2006 20:14:14 -0000 Date: Mon, 22 May 2006 15:14:14 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: Jagadish Prasath Ramu cc: pgsql-jdbc@postgresql.org Subject: Re: [BUGS] BUG #2444: XA Connections given by posgres driver has In-Reply-To: <200605191009.k4JA9OjS042465@wwwmaster.postgresql.org> Message-ID: References: <200605191009.k4JA9OjS042465@wwwmaster.postgresql.org> MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Archive-Number: 200605/102 X-Sequence-Number: 15230 Moving to -jdbc. On Fri, 19 May 2006, Jagadish Prasath Ramu wrote: > The following bug has been logged online: > > Bug reference: 2444 > Description: XA Connections given by posgres driver has auto-commit > value false by default > Details: > > Problem with PostgresDriver : postgresql-8.1-405.jdbc3.jar > > I am using the above driver to get an XA Connection and I found that > auto-commit value of it is false by default. > > Source : org/postgresql/xa/PGXAConnection.java > Constructor : > > PGXAConnection(BaseConnection conn) throws SQLException > { > super(conn, false); > this.conn =3D conn; > this.conn.setAutoCommit(false); > this.state =3D STATE_IDLE; > this.logger =3D conn.getLogger(); > } > > >> From JDBC Specification 3.0, Chapter 10.1.1 > Disabling AutoCommit mode : > > " The default is for auto-commit mode to be enabled when the Connection > object is > created. If the value of auto-commit is changed in the middle of a > transaction, the > current transaction is committed. It is an error to enable auto-commit for > a > connection participating in a distributed transaction, as described in > Chapter 12 > =E2=80=9CDistributed Transactions=E2=80=9D. " > > Chapter 12 > 12.4 Transaction Management : > "In contrast to the local case, the boundaries of a > distributed transaction must be controlled by an external transaction > manager that is > coordinating the work of multiple connections. For this reason, it is an > error for > applications to call any of the following Connection methods while they a= re > participating in a distributed transaction: > setAutoCommit(true) > commit > rollback > setSavepoint > The JDBC driver throws an SQLException if one of these operations is > attempted > on a connection that is participating in a distributed transaction. If the > connection is > later used for a local transaction, these operations are legal at that > point." > >> From these excerpts what I could understand is auto-commit for XA's > connection need to be true when created and auto-commit can not be set to > true when a transaction in progress. > I'm not sure what the purpose of this is. Why would you want a connection= =20 to be in autocommit =3D true when this is a condition you are explicitly no= t=20 allowed to set yourself? Kris Jurka