How to connect to SQL server 2017 from mac using python pyodbc

I develop a pet project using python and SQL server. I just solved a problem connecting to SQL server from python using pyodbc.

The short explanation is that pyodbc requirers SQL driver which is available for free from Microsoft.

If you wish to follow this guide you should have brew installed on your mac before you start.

There is a useful guide which explains how to use pyodbc here:

when I tried to connect the SQL server using the connection function - 

conn = pyodbc.connect('Driver={SQL Server};'

I received the following error:

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

The problem is with the driver "SQL Server".

To solve this issue I followed the guide provided by Microsoft:

I modified the connection string to use the new ODBC driver 

Driver={ODBC Driver 17 for SQL Server};Server=localhost;Database=myDatabase;UID=myUser;PWD=p@55word123;

Problem solved!


Spread the love

14 Replies to “How to connect to SQL server 2017 from mac using python pyodbc”

  1. Pingback: Leandro Farland
  2. Pingback: Leandro Farland
  3. Pingback: MILF City
  4. Pingback: Lila Lovely BBW
  5. Pingback: Make My Assignment
  6. Pingback: valentines gift
  7. Pingback: valentine pillow
  8. Pingback: Click Here
  9. Pingback: Click Here
  10. Pingback: Click Here

Leave a Reply