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

ResultSet.wasNull() does not return true after reading null value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Future Project
    • Icon: P5 P5
    • 5.0
    • 7
    • core-libs

      SYNOPSIS
      --------
      ResultSet.wasNull() does not return true after reading null value

      FULL JDK VERSION
      ----------------
      Java 6 (tested with 6u26)
      Also reproducible on 5.0 and JDK 7 (b147)

      OPERATING SYSTEM
      ----------------
      Reported on Windows XP
      (Linux/Solaris not tested)


      PROBLEM DESCRIPTION from LICENSEE
      ---------------------------------
      While reading a NULL value from the database using the JDBC-ODBC bridge, ResultSet.getString(), calling ResultSet.wasNull() returns false. It should return true.

      CR 4424215 seems to describe a similar issue, but it was reported against 1.3.0 and fixed in 1.3.1. However, we are currently seeing the same issue in Java 6 (we also see the problem with 5.0)

      REPRODUCTION INSTRUCTIONS
      -------------------------
      This testcase requires a functioning ODBC configuration.

      1. Edit the testcase (specifically, line 15) to ensure that it
         correlates with you local ODBC configuration.
      2. Compile and run the testcase.

      Observed output (using JDBC-ODBC bridge):

          URL = "jdbc:odbc:TOOLSDB;UID=xxxxxxxx;PWD=xxxxxxxx"
          CLOB wasNull: true
          BLOB wasNull: false length of data: -1 <-- problem
          CLOB wasNull: false length of data: -1 <-- problem
          BLOB wasNull: false length of data: 255

      Expected output (using DB2 JDBC driver):

          URL = "jdbc:odbc:ora92_gimli;UID=************;PWD=******"
          CLOB wasNull: true
          BLOB wasNull: true
          CLOB wasNull: false length of data: 255
          BLOB wasNull: false length of data: 255

      TESTCASE
      --------
      Testcase attached. Issue is highlighted at line 206-212.

      WORKAROUND
      ----------
      Use another JDBC driver, such as DB2.

            lancea Lance Andersen
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: