3
votes

I am new to Mac and having issues trying to get pyodbc to work. I have installed:

when I try to create a connection using the following connection string:

pyodbc.connect('DRIVER={Teradata};DBCName=XXX;DATABASE=XXX;Authentication=TD2;UID=XXX;PWD=XXX')

I get this error:

Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'Teradata' : file not found (0) (SQLDriverConnect)")

I have no idea where to go from here. Also, I am not sure if it is relevant but I am using virtualenvwrapper to create my python environment.

I see this similar question (return error is different). Connect Python to Teradata in mac with pyodbc and ran the export statements but I am still getting the same error

1
Did you follow the instructions found at developer.teradata.com/blog/odbcteam/2016/02/… - dnoeth
Those instructions are specific to UNIX - dobbysock1002

1 Answers

1
votes

I've been encounter this same problem. I took the actions below and the problem was solved (not sure which action really solve the problem, though).

  • Re-configure the pyodbc package.

    When installing pyodbc via Git, change the setup.py as follow

    elif sys.platform == 'darwin':
    # OS/X now ships with iODBC.
    settings['libraries'].append('iodbc')
    settings['libraries'].append('odbc')
    
  • Setting the environment variables for odbc.ini and library

    Check the odbc directory via

    sudo find / -name odbc*.ini 2>/dev/null 
    

    Then set the environment variables as (depending on your directory for odbc)

    export ODBCINI=/Library/Application\ Support/teradata/client/15.10/odbc/odbc.ini
    export ODBCSYSINI=/Library/Application\ Support/teradata/client/15.10/odbc
    export LD_LIBRARY_PATH=/Library/Application\ Support/teradata/client/15.10/lib:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH=/Library/Application\ Support/teradata/client/15.10/lib/:$LD_LIBRARY_PATH