[EMAIL PROTECTED] 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, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to