关于对只转发结果集的无效操作: last

对只转发结果集的无效操作: last
java.sql.SQLException: 对只转发结果集的无效操作: last
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.driver.BaseResultSet.last(BaseResultSet.java:91)
at E21NumberingPlanDiscrepancyAlert.getRegionPrefix(E21NumberingPlanDiscrepancyAlert.java:54)
at E21NumberingPlanDiscrepancyAlert.main(E21NumberingPlanDiscrepancyAlert.java:14)


查找除原因是prepareStatement需要重新定义

pstmt = sqlCon.prepareStatement(sql);

改成
pstmt = sqlCon.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
就可以了

你可能感兴趣的:(java,oracle,sql,jdbc)