Mailing List Archive

Read MS Access 97 *.mdb files with python??
Does somebody know some
piece of soft which can this??

Or does somebody know if the description of
the format ia avaible (for free of course).

Thanks

Stephan
Read MS Access 97 *.mdb files with python?? [ In reply to ]
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.

> 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.

ciao - chris

--
Christian Tismer :^) <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net
10553 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
we're tired of banana software - shipped green, ripens at home
Read MS Access 97 *.mdb files with python?? [ In reply to ]
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
Read MS Access 97 *.mdb files with python?? [ In reply to ]
Martijn Faassen wrote:
>
> Christian Tismer wrote:
> >
> > gemodek wrote:
> > >
> > > Does somebody know some
> > > piece of soft which can this??
> >
...
...
>
> 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..
>

First: Thanks for the fast response :-)

But,.. yes I am the guy who asked about accessing Access database on
Linux.
My idea is the following:
At my company we are running 4 Win95 PC's on a network which works
sometimes
and crash sometimes (some days no reboot, some days 5-10 times).
Now I am tired of the whole Win stuff, and I will install an Linux
Server
with Samba. (OK, the clients are still Win95, but at least the server is
linux).
We use also a software which is based on Access. The whole database (mdb
files) will reside on the Linux server.
So far so good.
But now, I want to extract some information out of the access database
to
create html files which everybody in our company is alowed to view.
And for this I need "access to Access".

Thats the whole story. I'm searching also for a format description
of access, but I did not find anything (up to now!).

bye

Stephan
Read MS Access 97 *.mdb files with python?? [ In reply to ]
I'm no expert but...
Put some data base package on your Linux machine that supports ODBC. I would
think that with lots of luck Access running on the Win boxes could connect
to it.

--Darrell


gemodek <gemodek@t-online.de> wrote in message
news:3728B7DF.80E23481@t-online.de...
> Martijn Faassen wrote:
> >
> > Christian Tismer wrote:
> > >
> > > gemodek wrote:
> > > >
> > > > Does somebody know some
> > > > piece of soft which can this??
> > >
> ...
> ...
> >
> > 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..
> >
>
> First: Thanks for the fast response :-)
>
> But,.. yes I am the guy who asked about accessing Access database on
> Linux.
> My idea is the following:
> At my company we are running 4 Win95 PC's on a network which works
> sometimes
> and crash sometimes (some days no reboot, some days 5-10 times).
> Now I am tired of the whole Win stuff, and I will install an Linux
> Server
> with Samba. (OK, the clients are still Win95, but at least the server is
> linux).
> We use also a software which is based on Access. The whole database (mdb
> files) will reside on the Linux server.
> So far so good.
> But now, I want to extract some information out of the access database
> to
> create html files which everybody in our company is alowed to view.
> And for this I need "access to Access".
>
> Thats the whole story. I'm searching also for a format description
> of access, but I did not find anything (up to now!).
>
> bye
>
> Stephan
Read MS Access 97 *.mdb files with python?? [ In reply to ]
gemodek wrote:
> My idea is the following:
> At my company we are running 4 Win95 PC's on a network which works
> sometimes
> and crash sometimes (some days no reboot, some days 5-10 times).
> Now I am tired of the whole Win stuff, and I will install an Linux
> Server
> with Samba. (OK, the clients are still Win95, but at least the server is
> linux).
> We use also a software which is based on Access. The whole database (mdb
> files) will reside on the Linux server.
> So far so good.
> But now, I want to extract some information out of the access database
> to
> create html files which everybody in our company is alowed to view.
> And for this I need "access to Access".

For the file format try:

http://www.wotsit.org/

Don't know whether they list it, but if they don't it's likely
that it's not published anywhere.

An alternative approach is using an Intersolv or OpenLink
multi-tier ODBC setup. Or use the EasySoft ODBC-ODBC bridge to
fill the gap between Linux and WinXX.

Then hook up Python to one of these using mxODBC (follow the link
below).

PS: I think I already mentioned this some days ago... under a
different subject, though.

--
Marc-Andre Lemburg Y2000: 246 days left
---------------------------------------------------------------------
: Python Pages >>> http://starship.skyport.net/~lemburg/ :
---------------------------------------------------------
Read MS Access 97 *.mdb files with python?? [ In reply to ]
"M.-A. Lemburg" wrote:
...
> For the file format try:
>
> http://www.wotsit.org/
>
> Don't know whether they list it, but if they don't it's likely
> that it's not published anywhere.

Just a note:

They give info about the .ldb format which is ridiculous,
just the format of the locking files, half an hour of
work to find out. The .mdb format is to my knowledge
documented nowhere. I know of exactly two companies
in the world which have tracked down this format to
an extreme extent, and who are able to recover a broken
database file. I once tried this for myself, but this
needs hundreds of hours, creating thousands of databases,
modifying data and comparing files.

ciao - chris

--
Christian Tismer :^) <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net
10553 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
we're tired of banana software - shipped green, ripens at home
Read MS Access 97 *.mdb files with python?? [ In reply to ]
On Thu, 29 Apr 1999 16:02:25 -0400, Darrell <news@dorb.com> wrote:
>I'm no expert but...
>Put some data base package on your Linux machine that supports ODBC. I would
>think that with lots of luck Access running on the Win boxes could connect
>to it.
>
>--Darrell

Hmm, I have a somewhat similar situation... I have databases in Access.
Currently, they are converted to cvs and read into mysql, which then serves
them to python via iODBC + mxODBC. Of course, I would much rather have Access
talk to mysql directly and be just a front-end for mysql, and the iODBC stuff
seems to imply this can be done... But I still can't figure out how to get
Access to do this... Anyone have a similar setup?

thanks!
Read MS Access 97 *.mdb files with python?? [ In reply to ]
Quinn Dunkan wrote:

> ... I have databases in
> Access. Currently, they are converted to cvs and read into mysql,
> which then serves them to python via iODBC + mxODBC. Of course, I
> would much rather have Access talk to mysql directly and be just a
> front-end for mysql, and the iODBC stuff seems to imply this can be
> done... But I still can't figure out how to get Access to do
> this... Anyone have a similar setup?

It's been years since I did this, but as I recall, you set up a
"System DSN" from Control Panel | ODBC for the remote DB. Then, in
Access, you use File | External Data | Link Tables and point to the
System DSN you just configured. I think this requires a "dummy"
Access mdb. There may be other ways to do it, but this is what looks
familiar as I poke around in Access's menus.

- Gordon
Read MS Access 97 *.mdb files with python?? [ In reply to ]
gemodek@t-online.de (gemodek) wrote:

>
>But,.. yes I am the guy who asked about accessing Access database on
>Linux.
>My idea is the following:
>At my company we are running 4 Win95 PC's on a network which works
>sometimes
>and crash sometimes (some days no reboot, some days 5-10 times).
>Now I am tired of the whole Win stuff, and I will install an Linux
>Server
>with Samba. (OK, the clients are still Win95, but at least the server is
>linux).

The problem with databases is a smooth migration path. Will a daily
(hourly?) copy of Access do while you migrate? or do all users need
to modify it all the time?

These tips might help:

(1) You can write something using Pythonwin and DAO to extract the
whole contents of an Access database - loop over the tables collection
and fetch them all. Either put them in another database (e.g. MySQL)
or make a dictionary of (name, table) pairs and marshal the lot. I
write a program once which took copies of a 3MB Access database and
reduced it to a 900kn marshalled Python file; the whole database
loaded into RAM in 1 second on a Pentium 90.

(2) Get MySQL, write a Python export program which runs under windows
as above, but inserts into te MySQL database using ODBC. Start
running it regularly Do some totalling/counting queries on both to
prove you have ported 100% of your data.

(3) If you can get your client programs to connect using the ODBC
driver, you can then switch Windows clients over the the MSQL server
with almost no effort.