java_jdbc_可滚动结果集与分页
2014-01-15 22:55
531 查看
public static void create2(int i) { Connection conn = null; Statement st = null; ResultSet rs = null; try { conn = JdbcUtils.getConnection(); st = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); rs=st.executeQuery("select * from t_user where id<10"); while(rs.next()){ System.out.print(rs.getObject("id")+" "); System.out.print(rs.getObject("username")+" "); System.out.print(rs.getObject("password")+" "); System.out.println(); } System.out.println("----------------------------------"); //定位到哪一条数据开始 rs.absolute(5); int k=0; //rs.previous() while(rs.next()&&k<10){ i++; System.out.print(rs.getObject("id")+" "); System.out.print(rs.getObject("username")+" "); System.out.print(rs.getObject("password")+" "); System.out.println(); } } catch (SQLException e) { throw new DaoExcetpion(e.getMessage(), e); } finally { JdbcUtils.free(rs, st, conn); } }
相关文章推荐
- JavaEE JDBC 可滚动和可更新的结果集ResultSet
- 正确使用MySQL JDBC setFetchSize()方法解决JDBC处理大结果集 java.lang.OutOfMemoryError: Java heap space
- java自学之路-----jdbc_分页查询,大数据,批处理,存储过程
- JDBC(二)大结果集分页,批处理,学习
- 正确使用MySQL JDBC setFetchSize() setMaxRows()方法解决JDBC处理大结果集 java.lang.OutOfMemoryError: Java heap space
- 第二十六章 可滚动结果集与分页技术
- [疯狂Java]JDBC:可滚动/可更新的ResultSet
- JDBC-结果集的特性(是否可滚动、是否敏感、是否可更新)
- Java - JDBC 结果集 ResultSet 转 List<Map> 类型,继而转 JSON 类型
- [疯狂Java]JDBC:ResultSet的升级RowSet、离线的CachedRowSet、离线分页查询
- MongoDB_Java连接mongo 将结果集分页
- JDBC滚动结果集、SQL注入、处理大数据、批处理、DAO模式介绍
- 可滚动的结果集操作(Jdbc,oracle数据库)
- [JSP&JDBC]连接数据库DAO增删查改+JavaBean+分页显示实例
- 初学JDBC__第六节(可滚动的结果集)
- Java JDBC 学习笔记 - 可更新的结果集
- [疯狂Java]JDBC:ResultSetMetaData(结果集元数据分析)
- 有关 SQLserver + JavaWeb端 多条件结果集 分页显示 的一点总结
- JAVA基础之JDBC开发、JSTL语法、EL表达式与数据分页
- java数据库编程——读写LOB、可滚动和可更新的结果集、元数据