('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
See original GitHub issueHi guys, I already had a look at previous similar issues but I could not find a proper solution. I am using a Jupyter notebook on Azure ML compute instance. I am trying to connect an Azure SQL database using pyodbc but I get below error: _(‘01000’, “[01000] [unixODBC][Driver Manager]Can’t open lib ‘ODBC Driver 17 for SQL Server’ : file not found (0) (SQLDriverConnect)”)_
My code:
import pyodbc
server = 'tcp:xxx.database.windows.net'
database = 'xxxx'
username = 'xxx'
password = 'xxxxx'
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
Environment
- Kernel: Python 3.6 Azure ML
- Python: 3.6.9 |Anaconda, Inc. [GCC 7.3.0]
- pyodbc: 4.0.27
- OS: 16.04.6 LTS (Xenial Xerus)
- DB: Azure SQL
- driver: ODBC Driver 17 for SQL
Issue
Expected behaviour: I expect to have a successfull connection, Observerd behaviour: No connection to the DB because it can not locate ODBC Driver 17 for SQL.
Extra information from similar questions online: 1- There is no microsoft folder in /opt folder (referring this question and solutions) 2- There is no odbcinst file in /etc folder (referring this question and solutions) 3- When I try pyodbc.drivers() it returns an empty array. (I uninstalled and reinstalled pyodbc, I am able to import it.) 4- I can not locate msodbcsql17 (referring here) 4- I tried ODBC Driver 13 as well, same problem exists.
Any help will be appreciated!
Issue Analytics
- State:
- Created 4 years ago
- Comments:33 (7 by maintainers)
Top Related StackOverflow Question
Did you actually install the driver as per the instructions here?
@gabraham00 - If
pyodbc.drivers()is returning an empty list then your unixODBC is not configured correctly. It should look like this: