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

DB2: Return an unexpected MetaData between ResultSet and CacheRowsSetImpl

XMLWordPrintable

    • generic
    • generic

      The ReadOnly and Writeable properties is not the same after ResultSet populate to CacheRowsSetImpl.

      Testsuite : rowset 2.0
      JDK : 1.5.0_03
      Database : DB2
      Driver :

      Failing Test :
      rowsetmetadata.rowsetmetadata1.RowSetMetaDataImpl1#testRSMDisReadOnly
      rowsetmetadata.rowsetmetadata1.RowSetMetaDataImpl1#testRSMDisWritable

      Simple test:
      ============
      import java.sql.*;
      import javax.sql.*;
      import com.sun.rowset.*;
      import javax.sql.rowset.*;
      import javax.sql.rowset.spi.*;

      public class jdbc_try2
      {
         public static void main(String args[])
         {
           Connection con = null;

           try
           {
             String driver, url;

             driver ="com.ibm.db2.jcc.DB2Driver";
             url = "jdbc:db2://129.145.128.193:50000/user1";
            
             Class.forName(driver).newInstance();
             Statement s;

             con = DriverManager.getConnection(url, "user1", "user1");
             s = con.createStatement();
             s.executeUpdate("DROP TABLE test");
             s.executeUpdate("CREATE TABLE test (age INT, name VARCHAR(50))");
             s.executeUpdate ("insert into test values(2,null)");
             s.close();


             RowSetMetaDataImpl rsmd1;
             ResultSetMetaData resmd1;

             CachedRowSetImpl crs1 = new CachedRowSetImpl();

             s = con.createStatement();
           
             ResultSet result = s.executeQuery ("Select * from test");
             resmd1 = result.getMetaData();
             System.out.println("ResultSet READONLY " + resmd1.isReadOnly(1));
             System.out.println("ResultSet WRITEONLY " + resmd1.isWritable(1));
             System.out.println("ResultSet Type and Con " + result.getType() + " " + result.getConcurrency());

             crs1.populate(result);
             rsmd1 = (RowSetMetaDataImpl)crs1.getMetaData();
             System.out.println("RowSet READONLY " + rsmd1.isReadOnly(1));
             System.out.println("RowSet WRITEONLY " + rsmd1.isWritable(1));
             System.out.println("CacheRowIMP Type and Con " + crs1.getType() + " " + crs1.getConcurrency());


           }
           catch (Exception e)
          {
            e.printStackTrace();
          }
         }
      }


      Output:
      ======

      ResultSet READONLY true
      ResultSet WRITEONLY false
      ResultSet Type and Con 1003 1007
      RowSet READONLY false
      RowSet WRITEONLY true
      CacheRowIMP Type and Con 1004 1008

      ###@###.### 2005-04-22 21:15:47 GMT

            ahandasunw Amit Handa (Inactive)
            tacheung Tak Wing Cheung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: