ADODB API
From IronPython Cookbook
Access data in MS Access database (MDB) using ADODDB API (http://adodbapi.sourceforge.net/ )
print "Access MDB - ADODB API style"
import adodbapi
conStr = r'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\path\to\your.mdb;'
con = adodbapi.connect(conStr)
cursor = con.cursor()
def showdata(sql):
cursor.execute(sql)
print '\n\nread', cursor.rowcount, 'rows in dataset\n', sql, '\n'
ds = cursor.fetchall()
for row in ds:
print row
def main():
showdata("SELECT * FROM tblTest")
showdata('SELECT id, Filler, [Submission Date] from tblChecklist')
# call stored procedure in Access
cursor.callproc('qryInsertChecklist')
print 'inserted', cursor.rowcount, 'rows'
main()
con.close()
x = raw_input('\n\nDONE\n\npress ENTER to end')
Thanks Vernon Cole for maintaining adodbapi module, and suggesting me to use it.
Installing adodbapi module for IronPython:
1) Unzip the file. 2) Create a site-packages folder under the Lib folder in your Python distribution (or provide some other entry on the Python search path if you wish and know how) 3) Copy the contents of the zip file there.
On my computer, I have:
'c:\\program files\\IronPython 2.6 for .NET 4.0\\lib\\site-packages\\adodbapi'
Works like a charm!

