为何不会rollback.解决思路

为何不会rollback...?代码如下。每次都会更新值,ROLLBACK没用么?Connectionconn dataSource.getConnectio

为何不会rollback...?
代码如下。每次都会更新值,ROLLBACK没用么?
Connection conn = dataSource.getConnection();
conn.setAutoCommit(false);
PreparedStatement pstmt = null;
pstmt = conn.prepareStatement("update test set name=? where id=?");
pstmt.setString(1, "GG");
pstmt.setInt(2, 3);
pstmt.executeUpdate();
conn.rollback();

[解决办法]

探讨
引用:

光看代码好像没有问题啊,
再从其他方面找找原因吧!

我纯写JDBC 也不行。。
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/jpetstore";
Connection conn = DriverManager.g……