I know this question was asked before but I never really got a proper answer that would solve my problem. I am trying to connect to a SQL server on a windows machine from a linux Open Suse12.4 machine.
pyodbc.connect('DRIVER={SQL Server};SERVER=servername;DATABASE=dbname;UID=userid;PWD=password')
the exact error I got was as below:
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found (0) (SQLDriverConnect)")
and below is my odbcinst.ini file :
[Easysoft ODBC-SQL Server]
Driver=/usr/local/easysoft/sqlserver/lib/libessqlsrv.so
Setup=/usr/local/easysoft/sqlserver/lib/libessqlsrvS.so
Threading=0
FileUsage=1
DontDLClose=1
UsageCount=2
[Easysoft ODBC-SQL Server SSL]
Driver=/usr/local/easysoft/sqlserver/lib/libessqlsrv_ssl.so
Setup=/usr/local/easysoft/sqlserver/lib/libessqlsrvS.so
Threading=0
FileUsage=1
DontDLClose=1
UsageCount=2
This post helped me to pinpoint my issue. My situation is that i have install the ODBC driver following this post "https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-RHEL-6-or-Centos-7" and turn out, i found that DRIVER "SQL Server" does not exist in my ini file. I changed DRIVER in connection string as "cnxn = pyodbc.connect("Driver={ODBC Driver 13 for SQL Server};Server=XXXXX;Database=XXX;Uid=XXX;Pwd=XXX;")" and it works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With