IBM Support

Java Toolbox JDBC How to get more information about an SQL message?

Question & Answer


Question

How do I get more information about an SQL message?

Answer

 If the IBM i database detects an error while it is carrying out your JDBC requests, the Toolbox JDBC driver will throw an SQLException with message text that is in the form "[SQLxxxx] Something went wrong". The first part is an IBM i message id, and the sentence that follows is first-level message text. While the first-level message text describes the error, you may want to get more information such as the cause of the error and possible recovery actions. This information is called second-level message text and is available to your program. One way to retrieve the second-level message text is to set the "errors" connection property to "full". This will cause the SQLException to include the second-level message text (if any) in the exceptions text (available by calling getMessage() on the SQLException object).
To see the complete message information (including the second-level message text) for message SQLxxxx, you can sign-on to an IBM i emulation session and issue the CL command:
DSPMSGD RANGE(SQLxxxx) MSGF(QSQLMSG)

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Component":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Product Synonym

IBM i;AS400

Document Information

Modified date:
05 March 2020

UID

ibm11118031