accessing access from Python on windows

dsavitsk dsavitsk at e-coli.net
Mon Jun 19 13:28:58 EDT 2000


i am trying to figure out why you would use odbc for access, unless you
planned to change your db and your os at some point.  DAO/Jet is certainly
easier, and ADO/OLEDB is more supported by M$ and will translate better to
other databases on win32.
from the one line of code it looks like you didn't use makepy yet. (Tools |
COM Makepy utility)
for ADO (ODBC/OLEDB) you will be better off using DSN-Less connection
strings as they are more portable, easier, more stable, and they run faster
(not a lot faster, but usually a little).

here's my $.02 on how easy dao is ...

import win32com.client
dbEngine = win32com.client.Dispatch(r"DAO.DBEngine.36")
db = dbEngine.OpenDatabase(DBName)
rs = db.OpenRecordset(TblName)

you can also access odbc using windll from www.nightmare.com

doug

"Marcin Kolbuszewski" <"Marcin.Kolbuszewski "@nrc.ca> wrote in message
news:394E51D1.71382D39 at nrc.ca...
> Hi there!
>
> I am running python 1.5.2 on Windows NT and am trying to
> access an Access database through ODBC. No lick though...:
>
> Traceback (innermost last):
>   File "C:\PROGRA~1\Python\Tools\idle\ScriptBinding.py", line 131, in
> run_module_event
>     execfile(filename, mod.__dict__)
>   File "D:\python\toc.py", line 3, in ?
>     import dbi, odbc
> ImportError: No module named dbi
>
> Where may I get the dbi and odbc modules?
>
> marcin Kolbuszewski





More information about the Python-list mailing list