把光标移到最后一条记录,rs.getRow()取得数组大小
把光标移到第一条记录,再写入int[];

解决方案 »

  1.   

    遍历resultset,然后将字段值放到数组里面
      

  2.   

    变形金刚:ArrayList 怎么办?运若与:不知道大小,如何初始化数组?
      

  3.   

     Array getArray(int i) 
              Returns the value of the designated column in the current row of this ResultSet object as an Array object in the Java programming language. 
     Array getArray(String colName) 
              Returns the value of the designated column in the current row of this ResultSet object as an Array object in the Java programming language. 如果你的jdbc支持这个方法的话:getFetchSize
    public int getFetchSize()
                     throws SQLException
    Returns the fetch size for this ResultSet object.
    Returns:
    the current fetch size for this ResultSet object
    Throws:
    SQLException - if a database access error occurs
      

  4.   

    二子:Array getArray(int i) 返回一个 object[] ,如何转成 int[],金刚:toArray()转成 Intger[]的可以,凑合了。
      

  5.   

    to xiaow: “ResultSet的getArray()方法也是莫名其妙。”所以告诉你
    getArray(int i)方法的用法,与你要达到的目的无关。