ADO/ODBC/ASP/Python error

Jason R. Coombs jaraconospam at jaraco.com
Mon Jan 7 18:24:36 EST 2002


Maybe I'm trying to use too many stacked technologies, but I think this
should work.  I would like to use Python in my ASP because VBScript doesn't
give me the flexibility I need.

I have an (access) database on the server, and an ODBC link to that database
with the System DSN 'EnvMon'.  This VBScript runs:
--------------------------
<HTML><HEAD><TITLE>enter sample</TITLE></HEAD><BODY>
<%
Dim conn

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=MSDASQL;DSN=EnvMon"
%>

Hello World
</BODY></HTML>
----------------------------
and I can query the database and whatever.
However, the equivalent Python fails:
------------------------
<HTML><HEAD><TITLE>enter sample</TITLE></HEAD><BODY>
<%@ language=Python %>
<%
from win32com import client

conn = client.Dispatch("ADODB.Connection")
conn.open ("Provider=MSDASQL;DSN=EnvMon")
%>

Hello World
</BODY></HTML>
----------------------------------
with the error

Error Type: Python ActiveX Scripting Engine (0x80020009)
Traceback (innermost last): File "<Script Block >", line 4, in ? conn.open
("Provider=MSDASQL;DSN=EnvMon") File "C:\Program
Files\Python\win32com\client\dynamic.py", line 432, in __getattr__ raise
pythoncom.com_error, details COM Error: [Microsoft][ODBC Driver Manager]
Data source name not found and no default driver specified


I receive the same exception if I run the commands directly from the
interpreter.  Since I am running this code on the same server with the same
COM components, the only difference I can see is that Python is not passing
the string parameter(s) as I expect it would to the ADODB.Connection
component.

I have tried to get the connection to work on other computers, but cannot
seem to esablish it there, either.  I have searched the web and this
newsgroup and found nothing that hinted at this problem.  Has anyone seen
this before?  Any recommendations on how I might locate the problem?

Jason





More information about the Python-list mailing list