title: How to get descriptive error messages from DB2?
body: <p>When I call a SQL statement via JDBC on the DB2 and the statement fails, I catch an SQLException with the following message text:</p>
  
  <pre><code>com.ibm.db2.jcc.a.nn: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703,
      SQLERRMC=O.METADATENSATZ, DRIVER=3.52.95
  </code></pre>
  
  <p>I tried an automatic translation of the message according to the <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzala/rzalaml.htm" rel="noreferrer">error list published by IBM</a>, but there are placeholders inside the messages referencing other elements of the exception. </p>
  
  <p>While looking for these elements inside the exception, I found the <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.apdv.java.doc/doc/r0021831.htm" rel="noreferrer"><code>DB2ExceptionFormatter</code></a> and tried to use it to access the missing elements.</p>
  
  <p>But here I stopped, because the <code>DB2ExceptionFormatter</code> gave me a clue:</p>
  
  <blockquote>
    <p>Error occurred while trying to obtain message text from server. Only message tokens are available.</p>
  </blockquote>
  
  <p><strong>So my question is:</strong> What do I have to configure to get the correct messages from the DB2 server? </p>
  
  <p>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.</p>