Re: Reading data from a Microsoft Access 2003 database

2010-05-25 Thread Jimoid
This is perfect if the python ODBC driver can read the .mdb  without
the need for it to be running elsewhere.

Thanks all for your help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading data from a Microsoft Access 2003 database

2010-05-22 Thread Gregory Ewing

On Thu, 20 May 2010 02:45:10 -0700 (PDT), Jimoid
jimmy.cul...@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 you mean that an instance of MS Access has to be running,
no, I don't think so. The ODBC driver for Access databases
knows how to open .mdb files itself. I've done this myself
recently, and it seems to work fine without having Access
running anywhere.

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


Re: Reading data from a Microsoft Access 2003 database

2010-05-21 Thread Adam Tauno Williams
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.cul...@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 awill...@whitemice.org LPIC-1, Novell CLA
http://www.whitemiceconsulting.com
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading data from a Microsoft Access 2003 database

2010-05-20 Thread Jimoid
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading data from a Microsoft Access 2003 database

2010-05-20 Thread Jimoid
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Simon Brunning
On 19 May 2010 10:28:15 UTC+1, Jimoid jimmy.cul...@gmail.com wrote:
 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.

mxODBC might well be what you are looking for,

-- 
Cheers,
Simon B.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Ahmed, Shakir

-Original Message-
From: python-list-bounces+shahmed=sfwmd@python.org
[mailto:python-list-bounces+shahmed=sfwmd@python.org] On Behalf Of
Simon Brunning
Sent: Wednesday, May 19, 2010 6:13 AM
To: python-list
Subject: Re: Reading data from a Microsoft Access 2003 database

On 19 May 2010 10:28:15 UTC+1, Jimoid jimmy.cul...@gmail.com wrote:
 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.

mxODBC might well be what you are looking for,

-- 
Cheers,
Simon B.
-- 

Or you can use pyodbc
DBfile = '/path/*.mdb
conn = pyodbc.connect('DRIVER={Microsoft Access Driver
(*.mdb)};DBQ='+DBfile, autocommit=True)
cursor = conn.cursor()

Thanks
Shakir

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Les Schaffer

Jimoid wrote:


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.


this worked like a charm for me:

http://code.activestate.com/recipes/528868-extraction-and-manipulation-class-for-microsoft-ac/

Les
--
http://mail.python.org/mailman/listinfo/python-list


Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Adam Tauno Williams
On Wed, 2010-05-19 at 08:05 -0400, Les Schaffer wrote:
 Jimoid wrote:
 
  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.
 
 this worked like a charm for me:
 http://code.activestate.com/recipes/528868-extraction-and-manipulation-class-for-microsoft-ac/

The OP: I use Ubuntu 64 bit

Does something that contains import win32com.client work on anything
other than Windows?
-- 
Adam Tauno Williams awill...@whitemice.org LPIC-1, Novell CLA
http://www.whitemiceconsulting.com
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Adam Tauno Williams
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+accesssubmit=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 awill...@whitemice.org LPIC-1, Novell CLA
http://www.whitemiceconsulting.com
OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Les Schaffer

Adam Tauno Williams wrote:


The OP: I use Ubuntu 64 bit


woops, my bad ...
--
http://mail.python.org/mailman/listinfo/python-list