Re: "postgresql-9.0-801.jdbc4.jar" Causing "Error committing transaction. Cause: org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled." Exception

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: emilu(at)encs(dot)concordia(dot)ca
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: "postgresql-9.0-801.jdbc4.jar" Causing "Error committing transaction. Cause: org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled." Exception
Date: 2011-06-01 00:18:51
Message-ID: 4DE5856B.9000206@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 06/01/2011 01:07 AM, Emi Lu wrote:

> When update/insert/delete is called, always got:
> ===================================================
> ### Error committing transaction. Cause:
> org.postgresql.util.PSQLException: Cannot commit when autoCommit is
> enabled.

Sounds like MyBatis expects autocommit to be disabled because it does
its own explicit BEGIN/COMMIT, but you've got it turned on. The newer
JDBC driver detects this and complains about it, where the older one
presumably ignored a COMMIT issued while in autocommit mode.

Add "autoCommit=false" to your connection parameters.

"autoCommit" doesn't appear to be documented in
http://jdbc.postgresql.org/documentation/head/connect.html#connection-parameters
, which is surprising.

--
Craig Ringer

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2011-06-01 00:53:27 Re: "postgresql-9.0-801.jdbc4.jar" Causing "Error committing transaction. Cause: org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled." Exception
Previous Message Dave Cramer 2011-05-31 22:42:53 Re: "postgresql-9.0-801.jdbc4.jar" Causing "Error committing transaction. Cause: org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled." Exception