try{
      dbTools = new DBTools();
      ResultSet chainRS=dbTools.getResultSet(getChainSql);
      while(chainRS.next()){
          iChainId = chainRS.getInt("chain_id");
          sSourceCol = chainRS.getString("source_col");
          sSourceColType = chainRS.getString("source_col_type");
          sAimCol = chainRS.getString("aim_col");
          sAimColType = chainRS.getString("aim_col_type");  
          //把数据链信息放入容器
          if(chainRS.isLast()){
            tempSelect = tempSelect+" "+sSourceCol;          }
          else{
            tempSelect = tempSelect+" , "+sSourceCol;
          }
    }
    catch(Exception e){
      return -1;
    }

解决方案 »

  1.   

    public Statement createStatement(int resultSetType,
                                     int resultSetConcurrency)
                              throws SQLException
    Creates a Statement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the createStatement method above, but it allows the default result set type and concurrency to be overridden. Parameters:
    resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
    resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE 
    Returns:
    a new Statement object that will generate ResultSet objects with the given type and concurrency 
    Throws: 
    SQLException - if a database access error occurs or the given parameters are not ResultSet constants indicating type and concurrency
    Since: 
    1.2 
    要使ResultSet可以滚动,必须得到Statement设定参数
      

  2.   

    谢谢shangqiao(伤桥)指点!合作与快!
    DBTools()是我自己写的操作数据库的n个方法
      

  3.   

    试试
     stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
              rs = stmt.executeQuery(sql);
      

  4.   

    conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);