1
import sqlalchemy as sa
import pyodbc
from sqlalchemy.sql import select

engine = sa.create_engine('mssql+pyodbc://user:password@ipaddress.domain.name/database')

con = engine.connect()

It is throwing me an error:

sqlalchemy.exc.DBAPIError: (pyodbc.Error) ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'SQL Server Native Client 10.0' : file not found (0) (SQLDriverConnect)")

Can any one please help me on this ?

Bhargav
  • 454
  • 1
  • 6
  • 15
  • I tried connecting through pyodbc aswell, but I wasnot able to. Does it has to do anything with database configuration – Bhargav Feb 14 '17 at 03:12

1 Answers1

0

Please check the below settings and try

1) Search for a file named libsqlncli* in your filesystem .Then check its :

A)permissions B) rows reporting "NOT FOUND" in the output of the ldd command executed against this file; C )If all seems to be ok check for/ddd the following entry in your odncinst.ini file:

*   

[SQL Server Native Client 1[0|1].0] Description=Microsoft SQL Server ODBC Driver V1.0 for Linux Driver=/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0 UsageCount=1

*

Nischey D
  • 189
  • 3
  • 18
  • Similar solution is given in this link as well http://stackoverflow.com/questions/34747635/how-to-connect-to-windows-sql-server-from-ubuntu – Nischey D Feb 14 '17 at 05:28