OpenJPA
  1. OpenJPA
  2. OPENJPA-184

use DB2 Diagnostic interface to report extended error diagnostics on SQL Exception

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      DB2 database

      Description

      When using DB2 database and the SQLException occurs
      if the SQLException instance supports the DB2Diagnosable interface,
      extended error information from the SQLCA will be written to the SQL channel.
      The message format produced by DB2Diagnosable writer is

      SQLCA OUTPUT[Errp=SQLDMISR, Errd=[-2146893819, 5, 0, 0, -957, 0]]
      Errp is the name of the DB2 module that detected the error and Errd are 6 integers of diagnostic information, SQLWARN are 6 characters
      of warning flags.. Often this additional information can be used by an administrator in doing problem determination.

      This message will be appended to the persistence exception error message already created by OpenJPA
      and it will be written to SQL logging channel (if active).

      DB2Dictionary class is modified to use java reflection on the SQLException instance to determine
      if it supports DB2Diagnosble methods "getErrp" and if so
      it invokes the methods to retrieve Errp and Errd fields, formats and logs the error message.
      Reflection is used so that the DB2Dictionary does not contain any compile time or runtime
      dependency on the DB2 jdbc driver. If the DB2Diagnosable methods do not exist on the SQLException
      instance, no extended error information is logged.

      org.apache.openjpa.jdbc.sql.SQLException class is modified so in the event of an exception
      if the Dictionary is DB2, to call the Dictionary routines above.

        Issue Links

          Activity

          Hide
          Albert Lee added a comment -

          Close issue in preparation for 2.2.0 release.

          Show
          Albert Lee added a comment - Close issue in preparation for 2.2.0 release.
          Hide
          Milosz Tylenda added a comment -

          Some documentation has been added in OPENJPA-1990.

          Show
          Milosz Tylenda added a comment - Some documentation has been added in OPENJPA-1990 .
          Hide
          Kevin Sutter added a comment -

          Sorry, I'm going to re-open this Issue. I don't see any mention of this added functionality in our OpenJPA documentation. Without documentation, the feature is not of much use. So, I think we should leave it open until it is properly documented.

          Show
          Kevin Sutter added a comment - Sorry, I'm going to re-open this Issue. I don't see any mention of this added functionality in our OpenJPA documentation. Without documentation, the feature is not of much use. So, I think we should leave it open until it is properly documented.
          Hide
          Michael Dick added a comment -

          Resolving issue per Ritika's comments on the dev mailing list.

          Show
          Michael Dick added a comment - Resolving issue per Ritika's comments on the dev mailing list.
          Hide
          Patrick Linskey added a comment -

          Is this issue still open?

          Show
          Patrick Linskey added a comment - Is this issue still open?
          Hide
          Patrick Linskey added a comment -

          > This message will be appended to the persistence exception
          > error message already created by OpenJPA and it will be written
          > to SQL logging channel (if active).

          I've found that doing logging and then throwing the same content in an exception becomes confusing. I'd prefer to see the core code only throw the exception. I believe that we discussed putting code in place that always logs all exceptions at OpenJPA's boundaries a while ago; I prefer that solution for people that can't manage to get exceptions logged / handled properly by their own frameworks. Thoughts?

          > org.apache.openjpa.jdbc.sql.SQLException class is modified so
          > in the event of an exception if the Dictionary is DB2, to call the Dictionary
          > routines above.

          I'd prefer not to see DB2-specific logic put into SQLException. How about changing SQLException to always call some new method in DBDictionary, and just only do something in the method in DB2Dictionary?

          Show
          Patrick Linskey added a comment - > This message will be appended to the persistence exception > error message already created by OpenJPA and it will be written > to SQL logging channel (if active). I've found that doing logging and then throwing the same content in an exception becomes confusing. I'd prefer to see the core code only throw the exception. I believe that we discussed putting code in place that always logs all exceptions at OpenJPA's boundaries a while ago; I prefer that solution for people that can't manage to get exceptions logged / handled properly by their own frameworks. Thoughts? > org.apache.openjpa.jdbc.sql.SQLException class is modified so > in the event of an exception if the Dictionary is DB2, to call the Dictionary > routines above. I'd prefer not to see DB2-specific logic put into SQLException. How about changing SQLException to always call some new method in DBDictionary, and just only do something in the method in DB2Dictionary?

            People

            • Assignee:
              David Wisneski
              Reporter:
              David Wisneski
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development