行不通。要求1的功能是数据库封装了的。不需要自己加以干预。即使你指定了位置,它也会给你打乱。要求2的功能可以通过sql语句来实现。而不是操作resultset来实现。

解决方案 »

  1.   

    直接用那个会出很多问题。封一次比较好,最好是用resultset取数据,用cachedrowset操作数据
    import sun.jdbc.rowset.CachedRowSet;  public CachedRowSet executeQuery(String sql) throws java.sql.SQLException {
        CachedRowSet cst = new CachedRowSet();
        try {
          conn = db.getConnection();
          ps = conn.createStatement();
          rs = ps.executeQuery(sql);
          cst.populate(rs);
          rs.close();
        }
        catch (SQLException e) {
          System.out.println(e.getMessage());
        }
        finally {
          db.CleanConnection(conn, ps, rs);
        }
        return cst;
      }