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)
- How can I modify a saved Microsoft Access 2007 or 2010 Import Specification? +31 (2008)
- OleDbCommand parameters order and priority +28 (2009)
- Is there an equivalent to the SUBSTRING function in MS Access SQL? +26 (2009)
- What do I need to read Microsoft Access databases using Python? +25 (2009)
- is there any replacement of Access? +21 (2009)
- MS-Access – you tried to execute a query that does not include the specified aggregate function +17 (2013)
ms-access solutions on this site
— top 9%.