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

CachedRowSetImpl always throw SQLException on attempt to update BOOLEAN column

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0u3
    • core-libs
    • None
    • b86
    • generic
    • generic
    • Verified

      SQLException text is "Exception in thread "Data Type Mismatch16"
      Run this code to reproduce the error:

      import javax.sql.RowSet;
      import javax.sql.rowset.CachedRowSet;
      import javax.sql.rowset.RowSetMetaDataImpl;
      import java.sql.Types;

      public class F1 {

          private static String cachedRowSetClass = "com.sun.rowset.CachedRowSetImpl";

          public static void main(String[] args) throws Exception {

              CachedRowSet rs = (CachedRowSet) Class.forName(cachedRowSetClass).newInstance();
              initInstance(rs);
          }

          protected static void initInstance(CachedRowSet crs) throws Exception {

              RowSetMetaDataImpl rsmdi = new RowSetMetaDataImpl();
              crs.setType(RowSet.TYPE_SCROLL_INSENSITIVE);
              rsmdi.setColumnCount(1);

              rsmdi.setColumnName(1, "_boolean_");

              rsmdi.setColumnType(1, Types.BOOLEAN);
              crs.setMetaData(rsmdi);

              // ========== add a few rows

              crs.moveToInsertRow();
              crs.updateBoolean(1, false);
              crs.insertRow();
          }

      }

            ssharmasunw Sushmita Sharma (Inactive)
            rmakarch Roman Makarchuk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: