出错代码如下:
static String u = "user";
static String p = "psw";
static String url = "jdbc:oracle:thin:@localhost:1521:db_name";
con = DriverManager.getConnection(url, u, p);
statement = con.createStatement();
String query1="select * from dm_mpg_test'";
ResultSet re1=statement.executeQuery(query1);
//get the number of the records
re1.last();
System.out.println("ResultSet size:"+re1.getRow());


报错java.sql.SQLException: 对只转发结果集的无效操作: last
需将statement定义成
statement = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
允许结果集可移动。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2021-07-02
猜你喜欢
  • 2021-12-13
  • 2021-12-18
  • 2021-12-23
  • 2022-12-23
  • 2021-09-19
  • 2021-12-29
相关资源
相似解决方案