tmolomby / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

problem with cursor.description tuple under 64-bit Linux (RHEL 6.2 x86_64) #266

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have installed the pyodbc package for both 32-bit and 64-bit Red Hat 
Enterprise Linux (versions 5.8 and 6.2).

When I examine the name element in the 7-elem tuple from cursor.description, on 
the 32-bit Linux systems, I get the full column name but on the 64-bit Linux 
systems, I am only getting the first character of the column name.

    cursor.execute(sql)
    for col in range(0, len(cursor.description)):
        col_name = cursor.description[col][0]
        col_type = cursor.description[col][1]
        col_size = cursor.description[col][2]

Is there a solution to this problem? Have others seen this on their 64-bit 
Linux systems.

If I code the equivalent task in Perl on the 64-bit Linux systems, it works so 
the problem is with the pyodbc package under 64-bit Linux.

Thank you.

Brad

_______________________________

Original issue reported on code.google.com by zolti...@mail.nih.gov on 24 May 2012 at 4:43

GoogleCodeExporter commented 9 years ago
I assume you are not passing ansi=True to connect...

What db are you using?  I'm guessing the issue is that Python is compiled with 
4-byte Unicode characters but  pyodbc is assuming 2-bytes.  Can you run the 
following:

    import pyodbc
    print 'python:  %s' % sys.version
    print 'pyodbc:  %s %s' % (pyodbc.version, os.path.abspath(pyodbc.__file__))
    print 'odbc:    %s' % cnxn.getinfo(pyodbc.SQL_ODBC_VER)
    print 'driver:  %s %s' % (cnxn.getinfo(pyodbc.SQL_DRIVER_NAME), cnxn.getinfo(pyodbc.SQL_DRIVER_VER))
    print '         supports ODBC version %s' % cnxn.getinfo(pyodbc.SQL_DRIVER_ODBC_VER)
    print 'os:      %s' % platform.system()
    print 'unicode: Py_Unicode=%s SQLWCHAR=%s' % (pyodbc.UNICODE_SIZE, pyodbc.SQLWCHAR_SIZE)

Original comment by mkleehammer on 17 Aug 2012 at 2:36

GoogleCodeExporter commented 9 years ago
No response, so closing.

Original comment by mkleehammer on 29 Sep 2012 at 4:48