文件testdb.jsp的源代码:
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@page import="java.sql.*,javax.sql.*,javax.naming.*,java.io.*"%><html>
<head>
<title>
</title>
</head>
<body>
<jsp:useBean id="db" scope="application" class="db.db" />
<%
String sql = "select pointid,road from gx_dsx";
ResultSet rs = db.executeQuery(sql);
rs.last();
//out.print(rs.getType()+"<br>");
while(rs.next()){
    out.print(rs.getString("pointid"));
    out.print("<br>");
}
%>
</body>
</html>其中的javabean,db的源代码:
package db;import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import java.util.*;public class db
{
    DataSource ds=null;
    Context initCtx=null;
    Context ctx=null;
    Connection conn =null;    public db(){
        
        try{
            initCtx = new InitialContext();
            ctx = (Context) initCtx.lookup("java:comp/env");
            ds = (DataSource) ctx.lookup("oracleDBPOOL");
            conn = ds.getConnection();
        }
        catch (SQLException e) {}
        catch (NamingException e) {}
     }     protected void finalize( ){
        try{conn.close();}catch(Exception e){}
     } 
     
     //查询记录
     public ResultSet executeQuery(String sql){
        
        ResultSet rs = null;
        try{
            Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            rs = st.executeQuery(sql);
        }
        catch(SQLException e){}        return rs;
     }
     
     //修改记录
     public int executeUpdate(String sql){
        int rows = 0;
        ResultSet rs = null;
        try{
            Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
            rows = st.executeUpdate(sql);
        }
        catch(SQLException e){}        return rows;
     }}在tomcat下运行testdb.jsp(配置正确),报错:“对只转发结果集的无效操作: last”
然后我在testdb.jsp中加入这句话out.print(rs.getType()+"<br>");
出来的结果是1003,查找jdk文档,对应的类型是ResultSet.TYPE_FORWARD_ONLY
可是我在db.java中明明用的是ResultSet.TYPE_SCROLL_INSENSITIVE,请问为什么会这样呢?