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

Clob.truncate with a value greater than the Clob length raises different exceptions in embedded and client driver


    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s:,,
    • Fix Version/s:
    • Component/s: JDBC
    • Labels:
    • Issue & fix info:
      Release Note Needed
    • Bug behavior facts:
      Embedded/Client difference


      Calling Clob.truncate with a value that is greater then the Clob length raises different SQLExceptions in the client and the embedded driver.
      o Client: SQLState.BLOB_LENGTH_TOO_LONG - XJ079
      o Embedded: SQLState.BLOB_POSITION_TOO_LARGE - XJ076

      I believe the fix is simple enough - change one of the exceptions.
      Which one most closely describes the situation?

      A release note is needed for this fix.

      Also note the following from the Java API docs:
      "void truncate(long len)
      throws SQLException

      Truncates the CLOB value that this Clob designates to have a length of len characters.

      Note: If the value specified for pos is greater then the length+1 of the CLOB value then the behavior is undefined. Some JDBC drivers may throw a SQLException while other drivers may support this operation.

      This opens for a change of behavior as well.
      There seems to an inconsistency in the docs, possibly due to rephrasing - it references both len and pos. The latter isn't used anywhere else in the JavaDoc for truncate.
      And what should the result of truncate(length+1) be?


        1. derby-3977-1a-change_emb_exception.diff
          2 kB
          Kristian Waagan
        2. derby-3977-2a-error_message_typo_fix.diff
          4 kB
          Kristian Waagan
        3. derby-3977-2a-error_message_typo_fix.stat
          0.1 kB
          Kristian Waagan
        4. releaseNote.html
          4 kB
          Kristian Waagan
        5. releaseNote.html
          4 kB
          Kristian Waagan



            • Assignee:
              kristwaa Kristian Waagan
              kristwaa Kristian Waagan
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: