Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4400352

java.sql.ResultSetMetaData.getColumnCount() can't return right result.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • core-libs
    • beta
    • x86
    • windows_98



      Name: boT120536 Date: 12/21/2000


      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      The java.sql.ResultSetMetaData.getColumnCount() can't return right result When
      a prepared Statement execute any king of SQL statement and return multiple
      results.

      --The java source code.

      import java.sql.*;
      class test
      {
      public static void main(String[] args)
      {
      try
      {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      Connection con = DriverManager.getConnection
      ("jdbc:odbc:test","sa",null);
      PreparedStatement ps = con.prepareStatement("select id
      from table1;select * from table1");
       // table1 have 3 fields(id,name,department).
      ps.execute();
      ResultSet rs = ps.getResultSet(); //return the first
      resultset.
      ResultSetMetaData rsmd = rs.getMetaData();
      System.out.println(rsmd.getColumnCount
      ()); //return 1.
      ps.getMoreResults(); // move the next resultset.
      rsmd = rs.getMetaData();
      System.out.println(rsmd.getColumnCount()); //
      return 1 all the same, why?
      }catch (Exception e)
      {
      System.out.println(e.toString());
      }
      }
      }
      (Review ID: 113473)
      ======================================================================

            jellissunw Jon Ellis (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: