public class ScrollTest {

    /**
     * @param args
     * @throws SQLException
     */
    public static void main(String[] args) throws SQLException {
        scroll();
    }

    static void scroll() throws SQLException {
        Connection conn = null;
        Statement st = null;
        ResultSet rs = null;
        try {
            // 2.建立连接
            conn = JdbcUtils.getConnection();
            st = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);
            rs = st
                    .executeQuery("select id, name, money, birthday  from user limit 150, 10");
            while (rs.next()) {
                System.out.println(rs.getObject("id") + "\t"
                        + rs.getObject("name") + "\t"
                        + rs.getObject("birthday") + "\t"
                        + rs.getObject("money"));
            }

            System.out.println("------------");
            rs.absolute(150);
            int i = 0;
            while (rs.next() && i < 10) {
                i++;
                System.out.println(rs.getObject("id") + "\t"
                        + rs.getObject("name") + "\t"
                        + rs.getObject("birthday") + "\t"
                        + rs.getObject("money"));
            }

            // if (rs.previous())
            // System.out.println(rs.getObject("id") + "\t"
            // + rs.getObject("name") + "\t"
            // + rs.getObject("birthday") + "\t"
            // + rs.getObject("money"));

        } finally {
            JdbcUtils.free(rs, st, conn);
        }
    }
}

最新文章

  1. unix编程书中的 ourhdr.h代码
  2. 用外部表的方式查询当天数据库alert日志文件
  3. php获取前一天后一天,php时间函数操作
  4. iOS - UICollectionViewController
  5. h264 流、帧结构
  6. JS原生方法实现jQuery的ready()
  7. java1.8的几大新特性(二)
  8. UFLDL教程(四)之Softmax回归
  9. linux中tar 打包指定路径文件
  10. JavaScript--我发现,原来你是这样的JS(引用类型不简单,且听我娓娓道来)
  11. id 选择器
  12. Uva - 12504 - Updating a Dictionary
  13. go实现选择排序
  14. Linux下DHCP服务安装配置
  15. java 类字面常量,泛化的Class引用
  16. easyui---修改删除查询
  17. [转载] python必碰到的问题---encode与decode,中文乱码
  18. springboot项目访问不到controller方法。
  19. Ceres入门笔记
  20. 微信小程序之特殊效果及功能

热门文章

  1. 【BZOJ】1996: [Hnoi2010]chorus 合唱队【区间dp】
  2. bzoj 3172: [Tjoi2013]单词 AC自动机
  3. acdream 1725 哗啦啦的小彭玉染色问题 离散化并查集
  4. Vue学习记录-状态管理
  5. MariaDB Audit Plugin 1.2
  6. set bin 集合
  7. 通过 WCF 实现点对点文件共享 z
  8. hdu-4725-The Shortest Path in Nya Graph-层次网络
  9. MySQL模糊查询(like)时区分大小写
  10. iOS:CoreData数据库的使用四(数据库和UITableViewController以及NSFetchedResultsController一起使用)