Database Updates fail with 'Can't call commit when autocommit=true'
Symptoms
The following error is thrown in the Bamboo logs, on INSERT's and UPDATE's:
2011-03-10 04:58:16.122019500 2011-03-10 04:58:16,121 ERROR [main] [AbstractUpgradeManager] java.sql.SQLException: Can't call commit when autocommit=true
2011-03-10 04:58:16.122020500 java.sql.SQLException: Can't call commit when autocommit=true
2011-03-10 04:58:16.122021500 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
2011-03-10 04:58:16.122021500 at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1544)
2011-03-10 04:58:16.122022500 at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.commit(DelegatingConnection.java:301)
Or
2017-03-19 06:41:24,742 ERROR [localhost-startStop-1] [AbstractUpgradeManager] org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled.
org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled.
at org.postgresql.jdbc.PgConnection.commit(PgConnection.java:785)
Resolution
- Applicable for MySQL only: Add
&relaxAutoCommit=true
to the end of your JDBC connection string / URL.
Example:
jdbc:mysql://localhost/bamdb?autoReconnect=true&relaxAutoCommit=true
- If using a Tomcat datasource, the equivalent of this is adding the following attribute to your datasource in
<bamboo-install>/conf/server.xml
: defaultAutoCommit="false"
Example:
<Resource name="jdbc/Bamboo" auth="Container" type="javax.sql.DataSource"
username="bamboo"
password="password"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/bamboo"
maxTotal="100"
maxIdle="10"
defaultAutoCommit="false"
validationQuery="select version();" />
Last modified on Mar 22, 2017
Powered by Confluence and Scroll Viewport.