patternMinor
IBM i Access ODBC driver returning only first letter of column names
Viewed 0 times
odbccolumnibmnamesreturningfirstdriverletteronlyaccess
Problem
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
This is a problem for me because when I try to query the database in applications (e.g. using the
My questions are:
EDIT:
This happens even if I try to give the columns aliases:
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 fetchedThis 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:
- Why is this happening?
- 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 fetchedSolution
I believe this is a bug with the specific version of IBM's driver I was using. I was using the ODBC driver from IBM i Access Client Solutions Linux AP v07.03.00.
I replaced that driver with the ODBC driver from IBM i Access for Linux v7.1.0-1.0 and now everything works as expected.
I replaced that driver with the ODBC driver from IBM i Access for Linux v7.1.0-1.0 and now everything works as expected.
Context
StackExchange Database Administrators Q#136225, answer score: 4
Revisions (0)
No revisions yet.