Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

autocomit and rollback problems with MySQL

843859Mar 3 2009 — edited Mar 4 2009
I'm using MySQL as my back-end. I get the following error when I try to execute any UPDATE or DELETE queries.
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Can't call rollback when autocommit=true
But, I've set the autocommit flag to false before calling rollback()
......
connectionUrl = "jdbc:mysql://localhost:3306/studentdb?"+"user=root&password=";
con = DriverManager.getConnection(connectionUrl);
if(con.getAutoCommit())
     con.setAutoCommit(false);
......
......
con.rollback();
......
It would be of great help if you guys help me to solve this.
Thank you.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 1 2009
Added on Mar 3 2009
7 comments
7,198 views