[Tutor] connecting to odbc
ali
rmangaliag@slu.edu.ph
Fri May 9 02:12:01 2003
thanks for the info, magnus....
what you just gave me is exactly what i need...
again... thank you very much...
----- Original Message -----
From: "Magnus Lyck=E5" <magnus@thinkware.se>
To: "ali" <rmangaliag@slu.edu.ph>
Cc: <tutor@python.org>
Sent: Thursday, May 08, 2003 11:52 PM
Subject: Re: [Tutor] connecting to odbc
> At 14:16 2003-05-08 +0800, ali wrote:
> >i have a problem connecting to my ms access database using odbc???
>
> There are several options here...and they work not only with
> MS Access, but for all databases you can access via ODBC on you
> computer.
>
> 1. You can use the OBDC module in win32all (or ActivePython) but
> it's not really maintained as far as I understand. I'd avoid
> that. (That's the "import odbc" etc.)
>
> 2. You can use mxODBC from egenix.com. Note that this requires
> a paid licence for commercial use.
>
> 3. You can use the new adodbapi by Henrik Ekelund. This might be
> your best choice. See http://adodbapi.sourceforge.net/
>
> 4. You can skip the DB-API all together, and access ADO directly
> through win32com. See http://www.e-coli.net/pyado.html
>
> 5. You can do the same as the previous, but using DAO. See
> http://starship.python.net/crew/bwilk/access.html
>
> mxODBC is the only solutions of these that work in other
> operating systems than MS Windows.
>
> >###########################
> >import odbc as o
> >con =3D o.odbc("connection string")
> >###########################
>
> This looks like the old, unmaintained Odbc module in win32all.
> I would avoid that.
>
> >but i dont know how to connect using the "new" way???
>
> What's the new way? As I said, this is old code, it does not
> follow the DB-API 2 standard.
>
> If you have set up a system DSN called "myDB" in the Windows
> Control Panel's "Data Source (ODBC)" setup, you can open it
> using
>
> con =3D o.odbc("myDB")
>
> But I suggest that you have a look at adodbapi if you want
> to follow the standard interface for accessing databases in
> Python, but only need to run your program on Windows for now.
> (That seems likely if you work with Access...)
>
>
> --
> Magnus Lycka (It's really Lyckå), magnus@thinkware.se
> Thinkware AB, Sweden, www.thinkware.se
> I code Python ~ The shortest path from thought to working program