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