connection.open using DSN

connection.open using DSN

Post by Sunish Abraha » Wed, 14 Feb 2001 13:26:14



I am running a W2K Advanced Server with SP1 using ADO v2.60.6526.0.  I
attempt the following code in an ASP page:
<%
dim cn
set cn = Server.CreateObject("ADODB.Connection")
cn.Open "DSN=LocalServer;UID=sa;PWD=;"
%>

and get the following error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified
/testdsn.asp, line 4

I trt the same code in a VBS file:
dim cn
set cn = Server.CreateObject("ADODB.Connection")
cn.Open "DSN=LocalServer;UID=sa;PWD=;"

and it works fine.  I try the ASP code on another W2K Advanced Server and it
works fine.  Any ideas?

Sunish Abraham

 
 
 

connection.open using DSN

Post by Carl Prothma » Thu, 15 Feb 2001 04:54:59


Make sure "LocalServer" is a SYSTEM DSN, not a USER DSN.

--

Thanks,
Carl Prothman
Microsoft Visual Basic MVP
http://www.able-consulting.com


Quote:> I am running a W2K Advanced Server with SP1 using ADO v2.60.6526.0.  I
> attempt the following code in an ASP page:
> <%
> dim cn
> set cn = Server.CreateObject("ADODB.Connection")
> cn.Open "DSN=LocalServer;UID=sa;PWD=;"
> %>

> and get the following error:
> Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
> [Microsoft][ODBC Driver Manager] Data source name not found and no default
> driver specified
> /testdsn.asp, line 4

> I trt the same code in a VBS file:
> dim cn
> set cn = Server.CreateObject("ADODB.Connection")
> cn.Open "DSN=LocalServer;UID=sa;PWD=;"

> and it works fine.  I try the ASP code on another W2K Advanced Server and
it
> works fine.  Any ideas?

> Sunish Abraham


 
 
 

connection.open using DSN

Post by Sunish Abraha » Thu, 15 Feb 2001 14:05:06


it is a System DSN.  why would it work in VBS file but not from IIS?
thanks!

Sunish


> Make sure "LocalServer" is a SYSTEM DSN, not a USER DSN.

> --

> Thanks,
> Carl Prothman
> Microsoft Visual Basic MVP
> http://www.able-consulting.com



> > I am running a W2K Advanced Server with SP1 using ADO v2.60.6526.0.  I
> > attempt the following code in an ASP page:
> > <%
> > dim cn
> > set cn = Server.CreateObject("ADODB.Connection")
> > cn.Open "DSN=LocalServer;UID=sa;PWD=;"
> > %>

> > and get the following error:
> > Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
> > [Microsoft][ODBC Driver Manager] Data source name not found and no
default
> > driver specified
> > /testdsn.asp, line 4

> > I trt the same code in a VBS file:
> > dim cn
> > set cn = Server.CreateObject("ADODB.Connection")
> > cn.Open "DSN=LocalServer;UID=sa;PWD=;"

> > and it works fine.  I try the ASP code on another W2K Advanced Server
and
> it
> > works fine.  Any ideas?

> > Sunish Abraham

 
 
 

connection.open using DSN

Post by Carl Prothma » Thu, 15 Feb 2001 23:20:26


Quote:> > > Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
> > > [Microsoft][ODBC Driver Manager] Data source name not found
> > > I trt the same code in a VBS file: and it works fine

You many have a bad install of MDAC.  Try reinstalling MDAC 2.6.

--

Thanks,
Carl Prothman
Microsoft Visual Basic MVP
http://www.able-consulting.com

 
 
 

connection.open using DSN

Post by Dennis Redfiel » Thu, 15 Feb 2001 23:38:12


Question: The VB program that 'works' - are you running on the same server
as the ASP page which FAILS?


Quote:> I am running a W2K Advanced Server with SP1 using ADO v2.60.6526.0.  I
> attempt the following code in an ASP page:
> <%
> dim cn
> set cn = Server.CreateObject("ADODB.Connection")
> cn.Open "DSN=LocalServer;UID=sa;PWD=;"
> %>

> and get the following error:
> Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
> [Microsoft][ODBC Driver Manager] Data source name not found and no default
> driver specified
> /testdsn.asp, line 4

> I trt the same code in a VBS file:
> dim cn
> set cn = Server.CreateObject("ADODB.Connection")
> cn.Open "DSN=LocalServer;UID=sa;PWD=;"

> and it works fine.  I try the ASP code on another W2K Advanced Server and
it
> works fine.  Any ideas?

> Sunish Abraham