1
我有这样的Java代码,不幸被更新所做的更改不会被传播到MySQL数据库:更新预处理语句不commiting
con = DriverManager.getConnection(url, user, password);
con.setAutoCommit(false);
preparedStatement = con.prepareStatement("update schema.t1 inner join
schema.t2 on (t1.id=t2.id)" +
" set t1.a=t2.a, t1.b=t2.b");
int r = preparedStatement.executeUpdate();
System.out.println("execute update result = "+r);
preparedStatement.close();
con.commit();
con.close;
如果我启用了自动提交查询,确,作品;但手动提交不传播到数据库的变化(我手动检查,并没有更新作出选择*从schema.t1其中a不是空)。
任何想法可能发生在这里?