Java.sql.SQLException:Can ' t call commit when autocommit=true at Com.mysql.jdbc.SQLError.createSQLException ( sqlerror.java:934) at Com.mysql.jdbc.SQLError.createSQLException (Sqlerror.java:931) at Com.mysql.jdbc.ConnectionImpl.commit (Connectionimpl.java:1646)
Today, when using Hibernate, the error is reported!
The reason for surfing the internet is because hibernate is used, commit () or rollback (), both of which require a prerequisite, that is, MySQL Auto-submit function to be closed.
Commit () is committed by committing the last commit or rollback of the modified content , and releasing the relevant content in the connection .
The role of rollback () is to rollback to the content of the last commit or rollback.
The above two methods can only be used in modes that have auto-commit disabled .
Therefore, turning off MySQL auto-commit is possible.
In the MySQL client:
Mysql>select @ @autocommit;
Check to see if auto-commit is turned on, and if 1, it turns on. If it is 0, it indicates off.
You can close it in the following way.
Mysql>set autocommit=0;
Http://www.cnblogs.com/xing901022/p/4183180.html
Can ' t call commit when autocommit=true (turn)