rs.last() gives Invalid operation for forward only resultset : last

后端 未结 2 2057
無奈伤痛
無奈伤痛 2020-12-06 04:37

I am trying to get the row count of a result set by:

rs.last();
int row_count = rs.getRow();

but im getting an Invalid operation for

2条回答
  •  天涯浪人
    2020-12-06 05:05

    PreparedStatement ps = conn.prepareStatement ("SELECT * FROM
             EMPLOYEE_TABLE WHERE LASTNAME = ?" ,
             ResultSet.TYPE_SCROLL_INSENSITIVE , 
             ResultSet.CONCUR_UPDATABLE ,
             ResultSet.HOLD_CURSOR_OVER_COMMIT) ;
    

    For prepared statements, you must specify, at a minimum, both the type and the concurrency mode for last() and isLast() to work.

提交回复
热议问题