469,282 Members | 2,000 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

Database Programming with Python

Hi

I wanted to connect Python to Ms-Access database using ADO or ODBC. I
have Python 2.5 and on mxODBC site, it has no higher version build
than 2.4. Moreoever, mxODBC is required for ADODB.
Can anyone guide me on this what should I do to make it work on Python
2.5? I have python 2.5 running on server.

Feb 9 '07 #1
4 2536
On Feb 9, 7:28 am, Finger.Octo...@gmail.com wrote:
I wanted to connect Python to Ms-Access database using ADO or ODBC. I
have Python 2.5 and on mxODBC site, it has no higher version build
than 2.4. Moreoever, mxODBC is required for ADODB.
Can anyone guide me on this what should I do to make it work on Python
2.5? I have python 2.5 running on server.
You could use Dejavu 1.5, which has its own wrapper [1] for ADO (both
MS Access and SQL Server/MSDE). No ODBC necessary or desired.

If you want an ADO wrapper without the full Dejavu ORM, it's possible
(but not heavily documented) to use dejavu's geniusql layer on its
own. That would give you connection mgmt (and pooling), along with the
ability to execute arbitrary SQL.
Robert Brewer
System Architect
Amor Ministries
fu******@amor.org

[1] http://projects.amor.org/dejavu/brow...ge/storeado.py

Feb 9 '07 #2
You could use Dejavu 1.5, which has its own wrapper [1] for ADO (both
MS Access and SQL Server/MSDE). No ODBC necessary or desired.

If you want an ADO wrapper without the full Dejavu ORM, it's possible
(but not heavily documented) to use dejavu's geniusql layer on its
own. That would give you connection mgmt (and pooling), along with the
ability to execute arbitrary SQL.

Robert Brewer
System Architect
Amor Ministries
fuman...@amor.org

[1]http://projects.amor.org/dejavu/browser/trunk/storage/storeado.py

There are no examples of Dejavu that I found yet. I have installed it
but don't know how to use or call its functions.

Feb 9 '07 #3
On Feb 9, 11:03 am, Finger.Octo...@gmail.com wrote:
There are no examples of Dejavu that I found yet. I have installed it
but don't know how to use or call its functions.
Read http://projects.amor.org/docs/dejavu/1.5.0RC1/ to learn how to
use Dejavu. It's short and should at least give you an idea whether or
not Dejavu is right for you.
Robert Brewer
System Architect
Amor Ministries
fu******@amor.org

Feb 9 '07 #4
Fi************@gmail.com wrote:
>
I wanted to connect Python to Ms-Access database using ADO or ODBC. I
have Python 2.5 and on mxODBC site, it has no higher version build
than 2.4. Moreoever, mxODBC is required for ADODB.
Can anyone guide me on this what should I do to make it work on Python
2.5? I have python 2.5 running on server.
You don't actually need mxODBC to use ADODB. As long as you have the
pywin32 extensions, you have what you need.

import win32com.client
conn = win32com.client.Dispatch('ADODB.Connection')
conn.Open( "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=xxxxx.mdb" )
cmd = win32com.client.Dispatch('ADODB.Command')
cmd.ActiveConnection = conn

cmd.CommandText = "SELECT firstname,lastname FROM users;"
rs = cmd.Execute()[0]
while not rs.EOF:
# Use elements of rs
rs.MoveNext()

There are samples on the web. Google should help.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Feb 11 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Patrick K. O'Brien | last post: by
3 posts views Thread by Michael T. Babcock | last post: by
5 posts views Thread by Steve Holden | last post: by
6 posts views Thread by Wolfgang Keller | last post: by
23 posts views Thread by herraotic | last post: by
2 posts views Thread by GinTon | last post: by
38 posts views Thread by ifti_crazy | last post: by
7 posts views Thread by erikcw | last post: by
14 posts views Thread by mark | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.