1.将Connection的Auto commit改成false.-->Connetion conn; conn.setAutoCommit(false);
2.执行需要在这次交易中完成的操作语句.
3.手动commit--->conn.commit();
4.将Connection的Auto commit改回true.-->conn.setAutoCommit(true);
5.抓Exception,如果出错.conn.rollback(); 并且conn.setAutocommit(true);