1
如何在CsvJdbc中启用ResultSet.getRow()?Csv Jdbc:ResultSet.getRow()不受支持
(这是应该返回当前行数的函数)
它似乎依赖一个isScrollable
构件上。如果以前有人遇到过这个问题,你如何解决它?
- 这是我需要在
Properties
传入的对象中设置的属性吗? - 我需要“消毒”还是以某种方式修改我的CSV文件?
谢谢!
更多信息
我使用有任何JDBC源导入数据的能力的应用程序。我需要从CSV文件中获取一些数据,因此我使用CsvJdbc。这个应用程序需要访问它导入的每一行数据的行号,不幸的是CsvResultSet#getRow()抛出一个异常,抱怨“Csv Jdbc:ResultSet.getRow()不受支持”。
以下是impl。在CsvJdbc的getRow()
方法(1.0.5)
/**
* Retrieves the current row number. The first row is number 1, the
* second number 2, and so on.
*
* @return the current row number; <code>0</code> if there is no current row
* @exception SQLException if a database access error occurs
*/
public int getRow() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
return currentRow;
} else {
throw new UnsupportedOperationException(
"ResultSet.getRow() unsupported");
}
}
通过源的其余部分寻找的似乎是,isScrollable
构件属性设置的唯一地方是在构造和作为默认值。
我一直在研究CSV查询SQL .. CsvJdbc是否满足通常的SQL要求(例如'ORDER BY','GROUP BY','JOIN'等)?如果不是,你用它来实现这个目标?谢谢 – 2011-09-21 13:26:58