0
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Main {
    public static void main(String[] args) throws SQLException {
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/python", "root", "vikalp");
        connection.setAutoCommit(false);
        try(Statement cursor = connection.createStatement()){
            cursor.execute("CREATE TABLE sa(id int)");
        }
        connection.rollback();

    }
}

Here python is my database name why the rollback doesn't happen? How to make it rollback?

vikalp rusia
  • 95
  • 1
  • 11

0 Answers0