1. Derby
  2. DERBY-1369

Provide client localization for severe server side exceptions



      Error messages for severe server side exceptions do not get localized according to the client locale. It would be good for these to be localized and print in the same format as other exceptions.

      Perhaps this could be achieved by bundling these messages with client. Care would need to be taken for compatibility. The current behaviour is described below:

      Client relies on calling the SYSIBM.SQLCAMESSAGE procedure to retrieve the message text. For severe errors
      >= ExceptionSeverity.SESSION_SEVERITY
      we do not get the localized exception according to the client locale. We cannot call the stored procedure to get the localized exception from the server, so the server just sends the preformatted message in the message tokens according to the server locale and the client prints out a message like this:

      connect 'jdbc:derby://localhost:1527/wombat';
      Connection number: 2.
      ERROR XJ040: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'wombat', see the next exception for details.::SQLSTATE: XSLAPDatabase at C:\marsden\repro\7594\wombat is
      at version 10.2 beta. Beta databases cannot be upgraded,

      This is the code where this processing is done in the server DRDAConnThread
      // If this is not an EmbedSQLException or is a severe excecption where
      // we have no hope of succussfully calling the SYSIBM.SQLCAMESSAGE send
      // preformatted message using the server locale
      sqlerrmc = buildPreformattedSqlerrmc(se);
      // Truncate the sqlerrmc to a length that the client can support.
      int maxlen = (sqlerrmc == null) ? -1 : Math.min(sqlerrmc.length(),
      if ((maxlen >= 0) && (sqlerrmc.length() > maxlen))
      // have to truncate so the client can handle it.
      sqlerrmc = sqlerrmc.substring(0, maxlen);
      return sqlerrmc;


        Kathey Marsden created issue -
        Gavin made changes -
        Field Original Value New Value
        Workflow jira [ 12372774 ] Default workflow, editable Closed status [ 12798010 ]


          • Assignee:
            Kathey Marsden
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: