Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-4949

Backward, confusing error message when you use the wrong ResultSet.getXXX() method in the client driver

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.8.1.2
    • 10.8.1.2
    • Network Client
    • None
    • Repro attached
    • Embedded/Client difference

    Description

      If you try to get a Time value out of an INTEGER column, the client driver gives this error. I believe that similar nonsense comes back when you try other mismatched getters on other datatypes:

      "An attempt was made to get a data value of type 'java.sql.Types 4' from a data value of type 'java.sql.Time'."

      The exception is a java.sql.SQLDataException with SQLState 22005. The embedded driver returns a better message:

      "An attempt was made to get a data value of type 'java.sql.Time' from a data value of type INTEGER'."

      I recommend two improvements to the utility method which generates these exceptions:

      1) Flip the order of the type names.

      2) Use the ResultSetMetaData to look up the source data type name.

      Attachments

        1. zz.java
          1 kB
          Richard N. Hillegas
        2. derby-4949-01-aa-fixCursor.diff
          9 kB
          Richard N. Hillegas

        Activity

          People

            rhillegas Richard N. Hillegas
            rhillegas Richard N. Hillegas
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: