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

posted on 2016-07-06 16:52  Just_Boy  阅读(90)  评论(0)    收藏  举报