PyODBC : can't open the driver even if it exists

后端 未结 7 987
一向
一向 2020-12-31 01:03

I\'m new to the linux world and I want to query a Microsoft SQL Server from Python. I used it on Windows and it was perfectly fine but in Linux it\'s quite painful.

相关标签:
7条回答
  • 2020-12-31 01:44

    I had the same problem 'file not found (0) (SQLDriverConnect)' on MAC OS with the following code

    cnxn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER=myServerIP,1433;DATABASE=myDBName;UID=sa;PWD=dbPassword')

    after googling for two days, I cannot fix the issue even modify the freetds.conf, odbcinst.ini and odbc.ini

    finally, I found the solution via replacing DRIVER value

    cnxn = pyodbc.connect('DRIVER={/usr/local/lib/libmsodbcsql.13.dylib};SERVER=myServerIP,1433;DATABASE=myDBName;UID=sa;PWD=dbPassword')

    My dev environment

    • MAC OS El Capitan
    • python 3.6.1 in Anaconda
    0 讨论(0)
提交回复
热议问题