Read from Microsoft Access via DAO and Python

Simple Database access to Microsoft Access via DAO and Python on Windows.

import win32com.client
daoEngine = win32com.client.Dispatch('DAO.DBEngine.35')
db = 'c:\\test\\mydatabase.mdb'
daoDB = daoEngine.OpenDatabase(db)
query = 'SELECT * FROM my_table WHERE my_attribute = 'my_search_value'
daoRS = daoDB.OpenRecordset(query)
print daoRS

Read from a Microsoft Access database with ADODB

This example demonstrates how to read from a Microsoft Access database
via AdoDB and Python/Pywin32. This code opens a test database and
prints the names of the columns.

import win32com.client

connection = win32com.client.Dispatch(r'ADODB.Connection')
DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=c:\\pfad\\testdb.mdb;'
recordset = win32com.client.Dispatch(r'ADODB.Recordset')
recordset.Open('SELECT * FROM Auftraege', connection, 1, 3)
fields_dict = {}
for x in range(recordset.Fields.Count):
    fields_dict[x] = recordset.Fields.Item(x).Name
    print fields_dict[x], recordset.Fields.Item(x).Value