idle in transaction with JDBC interface

Started by Gaetano Mendolaalmost 22 years ago1 messages
#1Gaetano Mendola
mendola@bigfoot.com

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