MS Access library for python

calendar_today Asked Jun 26, 2009
thumb_up 24 upvotes
history Updated April 16, 2026

Question posted 2009 · +17 upvotes

Is there a library for using MS Access database in python? The win32 module is not as easy as the MySQL library. Is there a simpler way to use MS Access with Python?

Accepted answer +24 upvotes

Depending on what you want to do, pyodbc might be what you are looking for.

import pyodbc
db_file = r'''C:x.mdb'''
user = 'admin'
password = ''

odbc_conn_str = 'DRIVER={Microsoft Access Driver (*.mdb)};DBQ=%s;UID=%s;PWD=%s' %
                (db_file, user, password)
# Or, for newer versions of the Access drivers:
odbc_conn_str = 'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=%s;UID=%s;PWD=%s' %
                (db_file, user, password)

conn = pyodbc.connect(odbc_conn_str)

Top ms-access Q&A (6)

+24 upvotes ranks this answer #5 out of 55 ms-access solutions on this site — top 9%.