Access sql with python, please. I'm desperate
been there
beginner at python-on-windows.net
Wed Nov 12 19:52:52 EST 2003
DD <ad at ad.nl> wrote:
D> Hello,
D>
D> Could anyone please help me??
D> Is there somebody who could explain me how to make a connection to a access
D> database with a python cgi script.
D> I would like to use common sql commands in my python scripts as I can with
D> MySQLdb.
D> But I cannot even connect to the access database (see below).
D> Could anyone explain it to me as simple as possible please. I'm using
D> Windows XP, ActivePython 2.3.2 build 230 and Microsoft access(XP?)
D> I normally use Linux, but this has to be in MS office
D>
>>>> import win32api
>>>> import win32com.client
>>>> engine = win32com.client.Dispatch("DAO.DBEngine.35")
D> Traceback (most recent call last):
D> File "<interactive input>", line 1, in ?
D> File "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line 95,
D> in Dispatch
D> dispatch, userName =
D> dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
D> File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 84,
D> in _GetGoodDispatchAndUserName
D> return (_GetGoodDispatch(IDispatch, clsctx), userName)
D> File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 72,
D> in _GetGoodDispatch
D> IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
D> pythoncom.IID_IDispatch)
D> com_error: (-2147221230, 'Klasse is niet gelicenseerd voor gebruik', None,
D> None)
D>
D> thank in advance,
D>
D> Arjen
D>
D>
D>
In windows, you have to go into control panel, administrative tools,
odbc drivers and register the driver you want to use before you can
open a connection to it. I believe that is your problem. I am no
expert, just recently had the same issue in making a connection to
a sybase database.
More information about the Python-list
mailing list