hsqldb 2.3.2 jdbc 驱动不支持 ResultSet.first()?

hsqldb 2.3.2 jdbc driver does not support ResultSet.first()?

我正在玩 HSQLDB+JDBC 驱动使用 JDK 8。 使用 rs.next() 循环结果工作正常,但是,使用 rs.first() 不起作用:不支持功能?!是设计使然还是错误?

我打算使用Spring jdbc模板访问hsqldb,我担心如果以后遇到这样的问题我可能会卡住。

    String jdbcUrl = "jdbc:hsqldb:hsql://localhost:9999/configdb";
    try(Connection con = DriverManager.getConnection(jdbcUrl, "SA", "");
        PreparedStatement stmt = con.prepareStatement(
                                "SELECT * FROM contacts");
        ) {

        ResultSet rs = stmt.executeQuery();
        // rs.first() does not work !
        while(rs.next()){
            //do sth here
        }
    } catch (SQLException e) {
        throw new RuntimeException("test jdbc connection failed", e);
    }

尝试使您的结果集可滚动:

 PreparedStatement stmt= conn.prepareStatement("SELECT * FROM contacts",
   ResultSet.TYPE_SCROLL_SENSITIVE,
   ResultSet.CONCUR_UPDATABLE);

我认为这应该可行