Database Updates fail with 'Can't call commit when autocommit=true'
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
The following error is thrown in the Bamboo logs, on INSERT's and UPDATE's:
1
2
3
4
5
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
1
2
3
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:
1
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:
1
2
3
4
5
6
7
8
9
<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();" />
Was this helpful?