Trying to connect to SQL Server from an ASP with IIS 4.0

Trying to connect to SQL Server from an ASP with IIS 4.0

Post by Bob Vos » Tue, 14 Apr 1998 04:00:00



I am writing my first ASP web page to use SQL Server 6.5.  I have looked at
a number of sample pages and bought two books, but I can't open a
connection.  I always get the error "ADO could not find the specified
provider."  My web page, DSN definition and browser output are below.  Can
anyone tell me what I may be doing wrong?  

SQL Server 6.5 and IIS 4.0 are running on the same server.  The SQL Server
is using NT integrated security and I am logged in as Administrator.  

TIA

Bob
--------------------------------
<HTML>
<HEAD>
<TITLE>SQL Test</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">


<%=Time%><BR>

<%
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.Open "DSN=ARATest", "", ""
%>

</BODY>
</HTML>
--------------------------------
I created a System DSN using ODBC Data Source Administrator.  

Microsoft SQL Server ODBC Driver Version 03.50.0305

Data Source Name: ARATest
Data Source Description: ARATest
Server: (local)
Database: TestDB
Language: (Default)
Translation Option: Automatic
Log Long Running Queries: No
Log Driver Statistics: No
Use Integrated Security: Yes
Use Regional Settings: No
Prepared Statements Option: Drop temporary procedures on disconnect
Use Failover Server: No
Use ANSI Quoted Identifiers: Yes
Use ANSI Null, Paddings and Warnings: Yes
--------------------------------
Here is what my browser displays:

12:43:00 PM

ADODB.Connection error '800a0e7a'

ADO could not find the specified provider.

/sql.asp, line 12

 
 
 

Trying to connect to SQL Server from an ASP with IIS 4.0

Post by Gail Dobs » Wed, 15 Apr 1998 04:00:00


  I do it this way:

If fNeedRecordset Then
    Set DataConn1 = Server.CreateObject("ADODB.Connection")
    DataConn1.ConnectionTimeout = Session("DataConn1_ConnectionTimeout")
    DataConn1.CommandTimeout = Session("DataConn1_CommandTimeout")
    DataConn1.Open Session("DataConn1_ConnectionString"),
Session("DataConn1_RuntimeUserName"), Session("DataConn1_RuntimePassword")
    Set cmdTemp = Server.CreateObject("ADODB.Command")
    Set rsCallscallinit = Server.CreateObject("ADODB.Recordset")
        cmdTemp.CommandText = "SELECT callinit.callnum, callinit.corpcode,
callinit.bugrpt, callinit.handledby, callinit.probdesc, callinit.resdesc,
callinit.othernotes, callinit.startdttm, callinit.enddttm, callinit.closed,
rel2call, fucallnum, funotes FROM callinit left outer join callfu on
callinit.callnum=callfu.rel2call "
        cmdTemp.CommandText = cmdTemp.CommandText &" where
callinit.swcode='"&Session("SW")&"' and (callinit.startdttm between
'"&Session("Ststgdttm")&"' and '"&Session("Estgdttm")&"')
"&Session("stg_excl_order")
    cmdTemp.CommandType = 1
    Set cmdTemp.ActiveConnection = DataConn1
    rsCallscallinit.Open cmdTemp, , 1, 3
End If

In Global.asa:
Sub Session_OnStart
        '--Project Data Connection
                Session("DataConn1_ConnectionString") = "DSN=HelpDesk"
                Session("DataConn1_ConnectionTimeout") = 15
                Session("DataConn1_CommandTimeout") = 30
                Session("DataConn1_RuntimeUserName") = "DBA"
                Session("DataConn1_RuntimePassword") = "SQL"
End Sub

HTH


Quote:

><%
>Set objConnection = Server.CreateObject("ADODB.Connection")
>objConnection.Open "DSN=ARATest", "", ""
>%>

--

PC HotShots, Inc.
Baltimore, MD
410 426-7617
http:/www.pchotshots.com
--> Let us bring out the *Power* of your PCs <--


 
 
 

Trying to connect to SQL Server from an ASP with IIS 4.0

Post by Randall J. Lu » Wed, 15 Apr 1998 04:00:00


I don't believe you can use integrated security from a web server.
Integrated security means that you are using an NT logon.  I think
typically folks are setting up a logon in SQL Server which is accessed
via standard security.  Everyone accessing the web uses the same
logon, which may be the guest logon.

Randall J. Luce


Quote:>I am writing my first ASP web page to use SQL Server 6.5.  I have looked at
>a number of sample pages and bought two books, but I can't open a
>connection.  I always get the error "ADO could not find the specified
>provider."  My web page, DSN definition and browser output are below.  Can
>anyone tell me what I may be doing wrong?  

>SQL Server 6.5 and IIS 4.0 are running on the same server.  The SQL Server
>is using NT integrated security and I am logged in as Administrator.  

>TIA

>Bob

Randall J. Luce
EDS - Diversified Financial Services


 
 
 

Trying to connect to SQL Server from an ASP with IIS 4.0

Post by Derek W. Bott » Wed, 22 Apr 1998 04:00:00


I notice that you pass the connect string user name and password hard coded.
Is there a way to get the server to prompt for log in??

I have been trying to do this same thing, but I did not want to hard code
the login.  I would have preferred using some mechanism to force login
through the web server.


>  I do it this way:

>If fNeedRecordset Then
>    Set DataConn1 = Server.CreateObject("ADODB.Connection")
>    DataConn1.ConnectionTimeout = Session("DataConn1_ConnectionTimeout")
>    DataConn1.CommandTimeout = Session("DataConn1_CommandTimeout")
>    DataConn1.Open Session("DataConn1_ConnectionString"),
>Session("DataConn1_RuntimeUserName"), Session("DataConn1_RuntimePassword")
>    Set cmdTemp = Server.CreateObject("ADODB.Command")
>    Set rsCallscallinit = Server.CreateObject("ADODB.Recordset")
>In Global.asa:
>Sub Session_OnStart
> '--Project Data Connection
> Session("DataConn1_ConnectionString") = "DSN=HelpDesk"
> Session("DataConn1_ConnectionTimeout") = 15
> Session("DataConn1_CommandTimeout") = 30
> Session("DataConn1_RuntimeUserName") = "DBA"
> Session("DataConn1_RuntimePassword") = "SQL"
>End Sub

>HTH


says...

>><%
>>Set objConnection = Server.CreateObject("ADODB.Connection")
>>objConnection.Open "DSN=ARATest", "", ""
>>%>

>--

>PC HotShots, Inc.
>Baltimore, MD
>410 426-7617
>http:/www.pchotshots.com
>--> Let us bring out the *Power* of your PCs <--