How to get descriptive error messages from DB2?
Posted
by tangens
on Stack Overflow
See other posts from Stack Overflow
or by tangens
Published on 2010-04-27T09:41:25Z
Indexed on
2010/04/27
9:43 UTC
Read the original article
Hit count: 486
When I call a SQL statement via JDBC on the DB2 and the statement fails, I catch an SQLException with the following message text:
com.ibm.db2.jcc.a.nn: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703,
SQLERRMC=O.METADATENSATZ, DRIVER=3.52.95
I tried an automatic translation of the message according to the error list published by IBM, but there are placeholders inside the messages referencing other elements of the exception.
While looking for these elements inside the exception, I found the DB2ExceptionFormatter
and tried to use it to access the missing elements.
But here I stopped, because the DB2ExceptionFormatter
gave me a clue:
Error occurred while trying to obtain message text from server. Only message tokens are available.
So my question is: What do I have to configure to get the correct messages from the DB2 server?
If I can get a human readable message from the server, I could use it directly and wouldn't have to translate it by myself.
© Stack Overflow or respective owner