Skip site navigation (1) Skip section navigation (2)

Connection Idle in transaction

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Connection Idle in transaction
Date: 2004-04-08 21:20:36
Message-ID: c54fn6$dhm$1@floppy.pyrenet.fr (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hi all,
I'm facing a problem with the unfamous:

"idle in transaction"

problem. I'm using the JDBC driver.

Mainly the problem is that the JDBC interface doesn't
provide the method begin() for a transaction object,
of course this is not a JDBC postgres interface problem.

Let me explain what happen using the JDBC interface



Client  Side            |    Server Side
---------------------------------------------------

1) Open a connection    |    Connection accepted
                         |                       <- Connection Idle
2) set autocommit false |    begin;
                         |                       <- Idle in transaction
3) select now();        |    select now();
                         |                       <- Idle in transaction
4) commit;              |    commit; begin;
                         |                       <- Idle in transaction
5) select now();        |    select now();
                         |                       <- Idle in transaction
6) rollback;            |    rollback; begin;
                         |                       <- Idle in transaction


as you can easily understand there is no window time larger enough with
a connection  idle, I thin that the JDBC behaviour ( with the server I
mean ) is not really correct: if the application is waiting for a user
entry then the connection remain: idle in transaction.

This is the behaviour that I think it's better:


Client  Side            |    Server Side
---------------------------------------------------

1) Open a connection    |    Connection accepted
                         |                       <- Connection Idle
2) set autocommit false |    NOP
                         |                       <- Connection Idle
3) select now();        |    begin; select now();
                         |                       <- Idle in transaction
4) commit;              |    commit;
                         |                       <- Connection Idle
5) select now();        |    begin; select now();
                         |                       <- Idle in transaction
6) select now();        |    select now();
                         |                       <- Idle in transaction
7) rollback;            |    rollback;
                         |                       <- Connection Idle


AS you can see the JDBC driver must do a begin only before the
first statement.

Am I missing something ?





Regards
Gaetano Mendola




Responses

pgsql-jdbc by date

Next:From: Keith BottnerDate: 2004-04-08 21:47:58
Subject: Re: Visual tools
Previous:From: zhang-xDate: 2004-04-08 02:13:23
Subject: Re: Have some problem about the SSL connection by JDBC

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group