[Tutor] MS ODBC

bob bgailer at alum.rpi.edu
Tue Dec 6 16:45:28 CET 2005

At 09:57 PM 12/5/2005, Gregorius Gede Wiranarada wrote:
>how can i connect python to read data from ms access or ms foxpro?


Install (if you have not) Mark Hammond's pywin32 to get the odbc module

Create a Data Source (if you don't already have one) for the Visual 
FoxPro Driver. Call it VFP (or whatever). If you don't know what this 
means, ask.

import odbc
vfpconn = odbc.odbc(VFP)
vfpcursor = vfpconn.cursor()
vfpcursor.execute(sql) # this can be more complex, involving 
substitution parameters
rows = vfp..cursor.fetchall()

Also see http://www.python.org/windows/win32/odbc.html

More information about the Tutor mailing list