JDBC-常见异常

Operation not allowed after ResultSet closed

Statement stmt = connection.createStatement();
stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from t1");
//注意同一个Statement的新一次查询会关闭上一次的查询结果resultSet。
ResultSet rs2=stmt.executeQuery("select * from t2");
//因为rs已经关闭所以,下行会抛出异常,
rs.last();//这个函数的功能是Moves the cursor to the last row in this ResultSet object.


你可能感兴趣的:(JDBC-常见异常)