pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #2444: XA Connections given by posgres driver has auto-commit value false by default
4+ messages / 4 participants
[nested] [flat]

* BUG #2444: XA Connections given by posgres driver has auto-commit value false by default
@ 2006-05-19 10:09  Jagadish Prasath Ramu <jagadish.ramu@Sun.COM>
  0 siblings, 1 reply; 4+ messages in thread

From: Jagadish Prasath Ramu @ 2006-05-19 10:09 UTC (permalink / raw)
  To: pgsql-bugs@postgresql.org


The following bug has been logged online:

Bug reference:      2444
Logged by:          Jagadish Prasath Ramu
Email address:      jagadish.ramu@Sun.COM
PostgreSQL version: posgres driver
Operating system:   Fedora Core 4, Solaris
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 = conn;
        this.conn.setAutoCommit(false);
        this.state = STATE_IDLE;
        this.logger = conn.getLogger();
    }




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [BUGS] BUG #2444: XA Connections given by posgres driver has
@ 2006-05-22 20:14  Kris Jurka <books@ejurka.com>
  parent: Jagadish Prasath Ramu <jagadish.ramu@Sun.COM>
  0 siblings, 1 reply; 4+ messages in thread

From: Kris Jurka @ 2006-05-22 20:14 UTC (permalink / raw)
  To: Jagadish Prasath Ramu <jagadish.ramu@Sun.COM>; +Cc: pgsql-jdbc


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 = conn;
>        this.conn.setAutoCommit(false);
>        this.state = STATE_IDLE;
>        this.logger = 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
> “Distributed Transactions”. "
>
> 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 are
> 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 
to be in autocommit = true when this is a condition you are explicitly not 
allowed to set yourself?

Kris Jurka



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [BUGS] BUG #2444: XA Connections given by posgres	driver has
@ 2006-05-23 06:14  Jagadish Prasath Ramu <Jagadish.Ramu@Sun.COM>
  parent: Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Jagadish Prasath Ramu @ 2006-05-23 06:14 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc

Hi Kris,
I am trying to use this XA-Connection without any transaction context.

eg: I have a test case using 2 XA-Connections on 2 different DBs and
DB-operations go fine.
As a part of the test, I need to check whether the data is actually is
persisted. 
In this case,  I get a connection (XAConnection) from the datasource and
do a query. This connection's auto-commit value is false.
According to the JDBC 3.0 Specification, auto-commit need to be true
when created.  [ my case ]
Only when the connection is taking part in a transaction, setting
auto-commit value is not allowed.

Since I am using the connection without any transaction context,
auto-commit need to be true in this case according to the specification.

Thanks,
-Jagadish

On Mon, 2006-05-22 at 15:14 -0500, Kris Jurka wrote:

> 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 = conn;
> >        this.conn.setAutoCommit(false);
> >        this.state = STATE_IDLE;
> >        this.logger = 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
> > “Distributed Transactions”. "
> >
> > 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 are
> > 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 
> to be in autocommit = true when this is a condition you are explicitly not 
> allowed to set yourself?
> 
> Kris Jurka
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [BUGS] BUG #2444: XA Connections given by posgres	driver has
@ 2006-05-23 06:58  Chris Smith <cdsmith@twu.net>
  parent: Jagadish Prasath Ramu <Jagadish.Ramu@Sun.COM>
  0 siblings, 0 replies; 4+ messages in thread

From: Chris Smith @ 2006-05-23 06:58 UTC (permalink / raw)
  To: Jagadish.Ramu@Sun.COM; Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc

Jagadish Prasath Ramu wrote:
> In this case,  I get a connection (XAConnection) from the datasource
> and do a query. This connection's auto-commit value is false.
> According to the JDBC 3.0 Specification, auto-commit need to be true
> when created.  [ my case ]
> Only when the connection is taking part in a transaction, setting
> auto-commit value is not allowed.
>
> Since I am using the connection without any transaction context,
> auto-commit need to be true in this case according to the
> specification.

The auto-commit mode is specified to be ignored for any connection that is 
participating in a non-local transaction.  Hence, it doesn't matter whether 
auto-commit is true or false in the situation you're talking about.  The 
behavior is always as if auto-commit is false.

It does seem, though, that the flag should be set to false in order to 
comply by-the-letter, as useless as that is.

-- 
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation 




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-05-23 06:58 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-19 10:09 BUG #2444: XA Connections given by posgres driver has auto-commit value false by default Jagadish Prasath Ramu <jagadish.ramu@Sun.COM>
2006-05-22 20:14 ` Re: [BUGS] BUG #2444: XA Connections given by posgres driver has Kris Jurka <books@ejurka.com>
2006-05-23 06:14   ` Re: [BUGS] BUG #2444: XA Connections given by posgres	driver has Jagadish Prasath Ramu <Jagadish.Ramu@Sun.COM>
2006-05-23 06:58     ` Re: [BUGS] BUG #2444: XA Connections given by posgres	driver has Chris Smith <cdsmith@twu.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox