IBM i Access ODBC – Resolving Issue of ODBC Driver Returning Only First Letter of Column Names

db2db2-midrangeiseries

I'm new to DB2 and am connecting to a DB2 for i (V7R1) database using unixODBC and the IBM i Access ODBC driver for Linux.

When I query the database, the results only include the first letter of the column names. For example, a typical query run with the isql utility will give me something that looks like this:

SQL> SELECT column1, column2 FROM schema.table WHERE column1 = 12345
+--------+---------------------------------+
| C      | C                               |
+--------+---------------------------------+
| 12345  | Lorem ipsum dolar sit           |
+--------+---------------------------------+
SQLRowCount returns -1
1 rows fetched

This is a problem for me because when I try to query the database in applications (e.g. using the pyodbc library for Python), I can't access the results by column name; both columns are named "C" in the result set.

My questions are:

  1. Why is this happening?
  2. Is it possible to change this behavior? (How?)

EDIT:

This happens even if I try to give the columns aliases:

SQL> SELECT column1 as foo, column2 as bar FROM schema.table WHERE column1 = 12345
+--------+---------------------------------+
| F      | B                               |
+--------+---------------------------------+
| 12345  | Lorem ipsum dolar sit           |
+--------+---------------------------------+
SQLRowCount returns -1
1 rows fetched

Best Answer

The defect with only the first character of the column name being returned is described in IBM APAR SE63700:
http://www-912.ibm.com/n_dir/nas4apar.NSF/b6c9b771e38b5ea2862564c00079d110/0f43bb0435716de586257f340041ed7a?OpenDocument

The fix should be integrated into the new version of the IBM Access Client Solutions Application Package for Linux, due mid-July 2016.