JDBC
事务
不让自动提交
conn.setAutoCommit(false);
String sql=“update account set money=money-? where name=? and money>=200"
pstmt=conn.prepareStatement(sql);
pstme.setDouble(1,amutn);
pstmet.setString(2."hello");
String sql=“update account set money=money-? where name=? and money>=200"
pstmt=conn.prepareStatement(sql);
pstme.setDouble(1,amutn);
pstmet.setString(2."hello");
conn.commit();
demo 下载:http://note.youdao.com/yws/public/redirect/share?id=35972284bdc1dd067206b47539aa5b9d&type=false
浙公网安备 33010602011771号