int count = rs.getCounts();
Object [] object= new Object[count];

解决方案 »

  1.   

    rs.last();
    int rouCount=rs.getRow();//取得的记录数
    rs.beforFirst();
    Object[] obj=new Object[rowCount];//实例化数组
    while(rs.next())
    {
    .......
    .......
    }
    rs.close();
      

  2.   

    to lixiang823517(泥浆):
    java.sql.SQLException: 对只转发结果集的无效操作: lastpackage test;import java.sql.*;/**
     * <p>Title: </p>
     * <p>Description: </p>
     * <p>Copyright: Copyright (c) 2004</p>
     * <p>Company: </p>
     * @author not attributable
     * @version 1.0
     */public class DBConnect {  public static void main(String[] args) {
        try {
          Class.forName("oracle.jdbc.driver.OracleDriver");
          Connection conn = DriverManager.getConnection(
              "jdbc:oracle:thin:@192.168.5.115:1521:hvt", "hvtt", "hvtt");
          Statement stmt = conn.createStatement();
          String sql = "select * from HT_BASICINFO where AUTO_ID=1";
          String sql2 = "select * from HEAT_LOOPRELATION where SUPER_ID=2";
          ResultSet rs = stmt.executeQuery(sql2);
          int i =0;      rs.last();
          int rowCount = rs.getRow(); //取得的记录数
          rs.beforeFirst();
          Object[] obj = new Object[rowCount]; //实例化数组
          System.out.println("长度"+obj.length+"\t"+i);
          rs.close();
          stmt.close();
          conn.close();    }
        catch (Exception e) {
          e.printStackTrace();
        }  }}
    还有其他的方法么
      

  3.   

    Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY)
      

  4.   

    现在很少人用数组去取结果集了,一般都是用List 或者Vector
      

  5.   

    数组的速度比  List和Vector都快啊??为什么不用数租??
      

  6.   

    你得自己写一个函数.遍历一下ResultSet