From: Adam Tauno Williams on
On Wed, 2010-05-19 at 02:28 -0700, Jimoid wrote:
> Hi All,
> I use Ubuntu 64 bit and need to develop a programme (ideally in
> Python) to work on data that is contained in a Microsoft Access 2003
> database. I do not need to modify the database, simply read a few
> columns of data from some tables.
> Google hasn't been able to offer me a suitable solution to this

Google is a poor way to look for such things. It is better to go to
Freshmeat / SourceForge or PyPI directly.

Try <http://freshmeat.net/search?q=microsoft+access&submit=Search>

mdbtools is your best bet unless you are willing to pay for the EasySoft
drivers. I've had mixed success with mdbtools; if all you need to do
is extract data their ODBC driver will probably work.

If you are willing to use Jython (Python on the JVM) you have a *lot*
more options for this kind of thing.

> problem, and although there are some references to this problem in the
> archives of this group, they are mainly very old and I wonder if there
> is anything more recent that members could suggest to me?
> Python would be my language of choice, however if someone has any
> other suggestions then I'm open to ideas.
--
Adam Tauno Williams <awilliam(a)whitemice.org> LPIC-1, Novell CLA
<http://www.whitemiceconsulting.com>
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

From: Les Schaffer on
Adam Tauno Williams wrote:

> The OP: "I use Ubuntu 64 bit"

woops, my bad ...
From: Jimoid on
Thanks to all for your helpful suggestions.

So far I have installed and played around with mdbtools, and it
appears that I can use this from the shell to extract the information
I need, e.g. mdb-export for dumping an entire table or mdb-sql to run
a query. I am also interested by mxODBC and pyodbc as these seem to be
python only solutions, so could be useful for platform independent
python solutions (it may be that my programme will be used by some
Windows users, if it is successful).

To give it a bit of context, I am extracting data from the on-board
flight planning software from an aerial survey plane (the Access
database). I will extract the GPS data for each image taken so that I
can then georeference the images.

Cheers,

Jimmy
From: Jimoid on
I've now had a closer look at both pyODBC and mxODBC and it seems to
me that they both require the database to be running to be able to
query it. Is this correct? If so I think I will have to use mdb-* as
the database I want to query is not running.

Cheers,

Jimmy
From: Adam Tauno Williams on
On Thu, 2010-05-20 at 22:58 -0700, Dennis Lee Bieber wrote:
> On Thu, 20 May 2010 02:45:10 -0700 (PDT), Jimoid
> <jimmy.cullen(a)gmail.com> declaimed the following in
> gmane.comp.python.general:
> > I've now had a closer look at both pyODBC and mxODBC and it seems to
> > me that they both require the database to be running to be able to
> > query it. Is this correct? If so I think I will have to use mdb-* as
> > the database I want to query is not running.
> To my knowledge, all "ODBC" modules (in any language) rely upon a
> DBMS specific driver.

Correct (of course, so does DB-API if you are using a 'native' Python
connection).

> Where the DB-API definition defines the common
> Python side of a database interface, ODBC defines a common OS-level
> interface to the DBMS, using a named driver (driver specified in the
> connection string or, for Windows, externally with the connection string
> specifying the connection definition)

There is no distinction between how ODBC operates on Windows or LINUX.
Both use the same connection strings [provided the drivers have the same
names].

> to translate ODBC calls into actual DBMS calls.

Yes, just like a DB-API provider, except that the 'translation' happens
in the ODBC driver.
--
Adam Tauno Williams <awilliam(a)whitemice.org> LPIC-1, Novell CLA
<http://www.whitemiceconsulting.com>
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba