Search Postgresql Archives

Re: "postgresql-9.0-801.jdbc4.jar" always cause "org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled" Exception

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> SqlSession sql_session = sqlSessionFactory.openSession(false);
> ....
> sql_session.commit();
> 
> 

We'll presume that you intend (intentionally or otherwise) for auto-commit
to be on since you do not reference any actual JDBC method calls here...

> While for "8.4-702 JDBC 4", the same codes, no error at all.
> 
> Is this a bug for "postgresql-9.0-801.jdbc4.jar"?
> 
> Thanks a lot!
> Emi
> 

Arguably 8.4-702 was the bugged version and 9.0-801  corrects the behavior -
or rather enforces the fact you should not be in auto-commit mode AND
committing manually.  Since this is a major version change such a behavioral
change is to be expected.  It should also at least be documented - but
whether it is or not I do not know.

I would recommend disabling auto-commit and leaving your commit() calls in
place.  You are generally much better off dealing with transaction logic
explicitly instead of relying upon the driver to do it for you; though there
are always exceptions but you should code is so that you can request an
auto-commit session when you know you need one.

David J.



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux