From: faassen at pop.vet.uu.nl (Martijn Faassen)
Date: Thu, 29 Apr 1999 20:46:27 +0200
Subject: Read MS Access 97 *.mdb files with python??
References: <37287369.D6E67313@t-online.de> <3728867D.94B5BBF9@appliedbiometrics.com>
Message-ID: <3728A903.CF75B41A@pop.vet.uu.nl>
Content-Length: 1646
X-UID: 618                                                  

Christian Tismer wrote:
> 
> gemodek wrote:
> >
> > Does somebody know some
> > piece of soft which can this??
> 
> Use PythonWin, create an interface for
> Microsoft DAO (your version) with the
> makepy utility, and then use COM to access Access.
> 
> Something like
> 
> import win32com.client
> engine=win32com.client.Dispatch("dao.dbengine.35")
> 
> Then you can use every method of the database
> engine, as you can find in the VBA help file
> of your copy of the MS Access distribution.

You can also use ODBC, part of PythonWin as well:

import dbi, odbc # note import them in this order

# open database
db = odbc.odbc("mydatabase_odbc_alias")
# get cursor
cur = db.cursor()
# sql statement
sql = "select * from whatever"
# execute sql statement
cur.execute(sql)
# fetch all data
data = cur.fetchall()

More information is at:

http://www.python.org/topics/database/

Look at the database API specs (version 1 is still used in PythonWin, I
think).

Unfortunately, all this advice may be useless, as I noticed that he's
the same guy who asked about accessing an Access database on Linux. I
know Linux can do ODBC, but I doubt there are Access drivers for ODBC on
linux..

> > Or does somebody know if the description of
> > the format ia avaible (for free of course).
> 
> That's a long awaited feature which I guess will never
> be available.

What you could try for Linux is use a Windows script to convert the
stuff to something else, and then put it into some Linux database. You
use that one from there. The problem of course that it's hard to keep
everything synchronized and up to date that way.

Regards and good luck,

Martijn




