Retrieving complete error messages in isql

This short blog shares the solution for an issue one of our customers was having this morning.

The customer was using the isql program to test a connection to a DB2 database. The connection failed and the error message generated was not very helpful:

/usr/local/easysoft/unixODBC/bin/isql.sh MY_DSN
[ISQL]ERROR: Could not SQLConnect

Adding the verbose mode flag to the command line (-v) added a far more informative message to the output:

[S1000][unixODBC][Easysoft][ODBC-DB2 Driver][DRDA]General error: database name not
specified

The error text now clearly identifies the problem: the ODBC data source is missing a required attribute.

The general point to bear in mind here is that, by default, isql suppresses ODBC driver and ODBC Driver Manager errors that provide detail on the underlying reason for a connection failure. You should therefore always include the -v flag.

Further information