摘要: 我们在写数据库程序的时候,经常会需要获取某个表中的最大序号数,一般情况下获取刚插入的数据的id,使用select max(id) from table 是可以的。但在多线程情况下,就不行了。下面介绍三种方法(1) getGeneratedKeys()方法:程序片断:Connection conn = ; Serializable ret = null; PreparedStatement state = .; ResultSet rs=null; try { state.executeUpdate(); ... 阅读全文
posted @ 2012-09-12 13:25 神马和浮云 阅读(320) 评论(0) 推荐(0) 编辑