I Am Getting An Error While Connecting To An Sql Db In Jupyter Notebook
Solution 1:
Assumed that you are using Microsoft Azure Notebooks, I tried to reproduce your issue successfully, as below.
It was caused by the connection string you used.
On Azure portal, you will see three ODBC connection string, as the figure below.
Obviously, you are trying to use the second one which required the username and password of an Azure Active Directory account, as the figure said from the offical document Using Azure Active Directory with the ODBC Driver
And according to the same document, the ODBC Driver version 13.1 seems to not support this authentication way, please change to use ODBC Driver version 17 with {ODBC Driver 17 for SQL Server}
.
And first, please check msodbcsql17
which has been installed.
However, I tried to connect using msodbcsql17
, it failed by login timeout error. Even I tried to upgrade pyodbc
from 3.1.1
to 4.0.26
via !pip install pyodbc --upgrade
So please try and may get the successful connection, if you have to authenticate AAD for SQL Database connection. Or switch to the first connection way, to use SQL Database username and password to connect by pyodbc==3.1.1
(upgrade to 4.0.26
that will cause another error) and {ODBC Driver 13 for SQL Server}
, it works for me.
Hope it helps.
Post a Comment for "I Am Getting An Error While Connecting To An Sql Db In Jupyter Notebook"