From: | "Michael Paesold" <mpaesold(at)gmx(dot)at> |
---|---|
To: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Connection setAutoCommit() |
Date: | 2002-10-05 00:20:28 |
Message-ID: | 035d01c26c05$0265af90$4201a8c0@beeblebrox |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I have just wondered about the implementation of Connection.setAutoCommit().
At least the JDBC 1.3 API has this note:
NOTE: If this method is called during a transaction, the transaction is
committed.
With postgresql that is not the case, at least not for 7.2 of the jdbc
driver:
public void setAutoCommit(boolean autoCommit) throws SQLException
{
if (this.autoCommit == autoCommit)
return;
...
It think this is important to be consistent, otherwise it's not possible to
know the transaction state after setAutoCommit()
Any comments?
Another question: is it a generally good idea to start a new transaction
just after every setAutoCommit(), commit() or rollback()? Wouldn't it be
better to "begin;" just before the first statement to be executed? That
wouldn't leave so many open transactions when you have many open
connections.
Regards,
Michael Paesold
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas O'Dowd | 2002-10-05 06:08:06 | Re: JDBC and commit problems |
Previous Message | Barry Lind | 2002-10-04 20:38:31 | Re: jdbc driver question |