Wednesday, November 26, 2014

MySQL error java.sql.SQLException: Can't call commit when autocommit=true

When you see the error like below, please use the provided solution to get rid of this.

 

Caused by: java.sql.SQLException: Can't call commit when autocommit=true

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)

        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)

        at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1740)

        at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)

        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)

        at org.wso2.carbon.ndatasource.rdbms.ConnectionRollbackOnReturnInterceptor.invoke(ConnectionRollbackOnReturnInterceptor.java:51)

        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)

        at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:71)

        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)

        at org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:153)

        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)

        at org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:41)

        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)

        at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80)

        at com.sun.proxy.$Proxy14.commit(Unknown Source)

        at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.addAPI(ApiMgtDAO.java:4871)

        ... 65 more

 

 

Solution:

Use the url as shown here: <url>jdbc:mysql://varra:3306/DB_CARBON_IDENTITY?autoReconnect=true&amp;relaxAutoCommit=true</url>



Thanks & Regards,

Rajakrishna Reddy,

 

No comments:

Post a Comment