From: Dave Cramer <pg@fastcrypt.com>
To: emilu@encs.concordia.ca
Cc: pgsql-jdbc@postgresql.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: Tue, 31 May 2011 18:42:53 -0400
Message-ID: <BANLkTim_r+BeqD9qc7SVwBW+MPzcdCz7uA@mail.gmail.com> (raw)
In-Reply-To: <4DE52F68.9060909@encs.concordia.ca>
References: <4DE52F68.9060909@encs.concordia.ca>
On Tue, May 31, 2011 at 2:11 PM, Emi Lu <emilu@encs.concordia.ca> wrote:
> Hello list,
>
> JDBC8 returns autocommit = false; which is what I want.
>
> But when I upgrade to JDBC9, I got:
> ===================================================
> ### Error committing transaction. Cause:
> org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled.
>
> Is there anything need to be configured if using
> "postgresql-9.0-801.jdbc4.jar" to set autocommit = false always?
>
> I use springframework3.0.5 + mybatis3 to setup DB connections:
>
> applicationContext-mybatis.xml
>
> <bean id="dataSource"
> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> <property name="driverClassName" value="${driverClassName}" />
> <property name="url" value="${url}" />
> <property name="username" value="${username}" />
> <property name="password" value="${password}" />
> </bean>
>
>
> This codes return autocommit= false for JDBC8; while JDBC9 returns
> autocommit=true as default.
>
>
> Thanks a lot!
> Emi
> ---
>
> . Postgresql8.3
>
> . mybatis-3.0.5-SNAPSHOT.jar
> . mybatis-spring-1.0.1-SNAPSHOT.jar
> . spring3.0.5
>
> . postgresql-9.0-801.jdbc4.jar
>
>
> SqlSession sql_session = sqlSessionFactory.openSession(false);
> ....
> sql_session.commit();
>
>
>
>
As far as I know autocommit should be enabled by default in both instances.
Can you get the server logs ?
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, emilu@encs.concordia.ca
Subject: Re: "postgresql-9.0-801.jdbc4.jar" Causing "Error committing transaction. Cause: org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled." Exception
In-Reply-To: <BANLkTim_r+BeqD9qc7SVwBW+MPzcdCz7uA@mail.gmail.com>
References: <4DE52F68.9060909@encs.concordia.ca> <BANLkTim_r+BeqD9qc7SVwBW+MPzcdCz7uA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox