OperationalError: (‘08001’, ‘[08001] [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection (0) (SQLDriverConnect)’) with pyodbc on Mac OS x

I was getting the following weird error when running pyodbc on my Mac and trying to connect to my Windows Database:

  • OperationalError: ('08001', '[08001] [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection (0) (SQLDriverConnect)')

Using the wonderful powers of Google I came across this article:

https://github.com/microsoft/homebrew-mssql-release/issues/59#issuecomment-928957200

Following the information from JH88:

brew install openssl@1.1

# you might need to delete the old symlink first
# rm /usr/local/opt/openssl

ln -s /usr/local/Cellar/openssl@1.1/1.1.1l /usr/local/opt/openssl

I still wasn’t getting it to work, turns out Brew had installed version 1.1.1l_1 on my machine so I needed to do the following:

rm /usr/local/opt/openssl

ln -s /usr/local/Cellar/openssl@1.1/1.1.1l_1 /usr/local/opt/openssl

After that quick fix everything started working correctly again.

One thought on “OperationalError: (‘08001’, ‘[08001] [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection (0) (SQLDriverConnect)’) with pyodbc on Mac OS x

  1. Gaurav June 26, 2022 / 2:08 am

    Thanks for sharing the solution. After going through various github threads finally, this one worked.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.