当我使用 jdbc 和 phoenix 从 hbase 查询数据时, "resultset.first()" 抛出异常

When I use jdbc and phoenix to query data from hbase,the "resultset.first()" throw exception

代码如下:

像这样的异常:

java.sql.SQLFeatureNotSupportedException 在 com.salesforce.phoenix.jdbc.PhoenixResultSet.first(PhoenixResultSet.java:173)

如果您重新编码代码以使用 next() 而不是 first(),您会没事的:

while(resultset.next()) {
  //Do something with resultset
}

如果您正在寻找为什么……您将不得不去询问那个JDBC驱动程序的开发人员。由于在 ResultSet 内定位需要 可滚动 ResultSet,因此可能根本没有此功能。

ResultSet.first() 的实现尚未在 Apache Phenix 中完成。因此,你得到了错误。

 public boolean first() throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

尝试使用 ResultSet.next() 函数。