This minor release contains fixes of two tiny but quite nasty bugs:
1. Oracle 9i metadata browser fix (table/view lists reading was broken in 1.3.0)
2. DB2 clob/blob reading (DB2 driver doesn’t support scrollable result sets if LOB columns presents in it).
Also here are a few tips concerning DB2 driver and especially error messages:
DB2 JDBC driver is one of the most complicated and unconvenient JDBC drivers in the world. It has a lot of configurable parameters and many of them aren’t documented. As a result it is quite hard to properly configure the driver.
List of available connection properties
Another problem is DB2 error messages. By default they looks like this:
SQL Error [42831]: DB2 SQL Error: SQLCODE=-542, SQLSTATE=42831, SQLERRMC=COL1, DRIVER=3.59.81
Not very descriptive, indeed.
To get human readable error messages you should check the DB2 documentation and find the description of error “-542”. Or the driver itself can make additional requests to the server and obtain a formatted error message. As usual IBM doesn’t like to make it easy.
Easiest solution is to add extra connection parameter which tells DB2 driver to always read error messages from server.
- Open connection properties dialog
- Click on “Advanced” tab
- Right click on “User Properties” element
- Add new property retrieveMessagesFromServerOnGetMessage
- Set value of this new property to true
- Advanced properties should look like the screenshot. Click “Finish”
Now, after reconnect the same error as above will look like this:
SQL Error [42831]: "COL1" cannot be a column of a primary key or unique key because it can contain null values.. SQLCODE=-542, SQLSTATE=42831, DRIVER=3.59.81
This advanced property wasn’t set to true by default because sometimes it doesn’t work.
DB2 doc says:
Before you can use certain functions of the IBM® Data Server Driver for JDBC and SQLJ on a DB2® for z/OS® subsystem, you need to install a set of stored procedures and create a set of tables.
If your installation doesn’t have these procedures then setting retrieveMessagesFromServerOnGetMessage to true will make things even worse – you won’t get even an error code.