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

idle in transaction with JDBC interface

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: idle in transaction with JDBC interface
Date: 2004-04-08 11:49:59
Message-ID: 40753C67.6070000@bigfoot.com (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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, 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.

This is what I think it's better:


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

1) Open a connection    |    Connection accepted
~                        |                       <- Connection Idle
2) set autocommit false |
~                        |                       <- 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

















-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAdTxl7UpzwH2SGd4RAkPOAJwNgUsfkMpd9m5R4que7PxuFnrZvgCePbI9
hdCLD4fAI6vRnr224e9r0lk=
=gEQe
-----END PGP SIGNATURE-----


pgsql-hackers by date

Next:From: pgsqlDate: 2004-04-08 12:01:27
Subject: PostgreSQL configuration
Previous:From: Dennis BjorklundDate: 2004-04-08 07:31:57
Subject: Re: locale

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