When I try to connect to a sql server database with pyodbc (on mac):
import pyodbc
server = '####'
database = '####'
username = '####@####'
password = '#####'
driver='{ODBC Driver 13 for SQL Server}'
pyodbc.connect('DRIVER='+driver+';SERVER='+server+';PORT=1443;DATABASE='+database+';UID='+username+';PWD='+password)
I get the following error:
Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 13 for SQL Server' : file not found (0) (SQLDriverConnect)")
When I path in the actual driver location:
driver='/usr/local/lib/libmsodbcsql.13.dylib'
It starts working!
My odbcinst.ini
looks like this:
[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/usr/local/lib/libmsodbcsql.13.dylib
UsageCount=1
How can I get my reference to driver='{ODBC Driver 13 for SQL Server}'
to start working again?
I initially used this guide to install the driver. And I'm using anaconda on Mac Sierra if that helps?
odbc.ini
andodbcinst.ini
in/etc
. It will also check the user's home directory for.odbc.ini
and.odbcinst.ini
. (FreeTDS does the same withfreetds.conf
/.freetds.conf
, for the record.) – Felonry