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

Align error reporting in the client driver and embedded driver for streaming errors through the JDBC API

    XMLWordPrintableJSON

Details

    • Normal
    • Embedded/Client difference

    Description

      The way streaming errors are reported differ between the client driver and the embedded driver.

      The following SQLStates can be seen:
      XCL30.S=An IOException was thrown when reading a ''

      {0}'' from an InputStream.
      XSDA4.S=An unexpected exception was thrown
      22001=A truncation error was encountered trying to shrink {0}

      ''

      {1}'' to length {2}.
      XJ023.S=Input stream did not have exact amount of data as the requested length.
      XN014.S=Network protocol error: encountered an IOException, parameter #{0}. Remaining data has been padded with 0x0. Message: {1}

      .
      XN015.S=Network protocol error: the specified size of the InputStream, parameter #

      {0}, is less than the actual InputStream length.
      XN016.S=Network protocol error: encountered error in stream length verification, parameter #{0}

      . Message:

      {1}

      .
      XN017.S=Network protocol error: end of stream prematurely reached, parameter #

      {0}. Remaining data has been padded with 0x0.
      XN018.S=Network protocol error: the specified size of the Reader, parameter #{0}

      , is less than the actual InputStream length.

      Some of these exceptions are nested inside one or more of the other exceptions.
      There are basicly three types of streaming errors:
      a) The stream is too long for the column it is being inserted into
      b) The actual length of the stream does not match the specified length
      c) A general IOException is thrown when reading from the stream

      An approach would be to always throw specific exceptions for a) and b), for instance 22001 and XJ023, and throw a general exception for class c) exceptions (the message of the IOException would be wrapped/included).

      Note that the level of detail in client and embedded (in the top level exception) might vary; it can be XN017 on the client, but XSDA4 in embedded (for the same JDBC code causing the exception).

      Changing the SQLStates might impact existing applications, but aligning the drivers' behavior has high priority.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kristwaa Kristian Waagan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: