I can't connect to MS SQL Server in my Jupyter notebook:
Code:
import pyodbc
pyodbc.drivers()
Output:
[]
Nothing!
Connection string:
db_connection = pyodbc.connect('Driver={ODBC Driver 17 for SQL Server};'
'Server=Server IP;'
'Database=DB_Main;'
'UID=DB_User;'
'PWD=secrets')
Every conceivable driver string I use I get the same basic message:
Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
Since pyodbc.drivers()
isn't showing anything it would seem that the installation is borked.
UPDATE: I was unable to get the symlink solutions with the INI files to work as suggested here: Can't open lib 'ODBC Driver 13 for SQL Server'? Sym linking issue?
Directly specifying the driver as shown in the answer below is what worked.