摘要: 1. 原理代码示例public class JdbcPool implements DataSource { private static LinkedList list = new LinkedList(); static{ try{ InputStream in = JdbcPool.class.getClassLoader().getResourceAsStream("db.properties"); Properties prop = new Properties(); prop.load(in); String driver = prop.getProper... 阅读全文
posted @ 2013-12-18 16:54 今晚打酱油_ 阅读(322) 评论(0) 推荐(0) 编辑
摘要: 1. 事务指逻辑上的一组操作,组成这组操作的各个单元,要不全部成功,要不全部不成功。数据库开启事务命令•start transaction开启事务•Rollback 回滚事务•Commit 提交事务JDBC控制事务语句•Connection.setAutoCommit(false); //start transaction•Connection.rollback(); //rollback•Connection.commit(); //commit设置事务回滚点•Savepoint sp = conn.setSavepoint();•Conn.rollback(sp);•Conn.commit 阅读全文
posted @ 2013-12-18 15:37 今晚打酱油_ 阅读(3996) 评论(0) 推荐(0) 编辑