2

I'm trying to connect to a Microsoft Access database with pyodbc on Mac OS 10.12.6 with python version 3.6.4.

My code is the following:

conn_str = ('DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};'\
'DBQ=test.accdb;')

cnxn = pyodbc.connect(conn_str)

I receive an error while running the last line -

pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'Microsoft Access Driver (*.mdb, *.accdb)' : file not found (0) (SQLDriverConnect)")

I've double checked that my database is in the correct directory, and I've tried reinstalling pyodbc to make sure all of the libraries exist. I'm not sure what's going on.

svenkatesh
  • 1,152
  • 2
  • 10
  • 25

1 Answers1

1

Microsoft Access Driver (*.mdb, *.accdb) is Microsoft's ODBC driver for Access, and it is only available for Windows. If you want to work with Access databases directly from your Mac (i.e., without using a Windows virtual machine) then you'll either need to buy an Access ODBC driver for the Mac platform or consider one of the free options described here:

Working with an Access database in Python on non-Windows platform (Linux or Mac)

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418