I'm running Windows 10 Home (version 1709), using SQL Server 2014 on my local machine, and IIS (version 10.0.16299.15). Browser is Chrome.
I have set up an ODBC connection successfully (see code comments), and am calling it by name. I am not supplying username/password, since I am using Windows authentication. IIS for the Web site is set up as "Application user (pass-through authentication)"
As you can see my my commented-out lines, I've tried 3 different approaches: (1) creating cn.ConnectionString and using cn.Open; (2) prefixing the DSN with "DSN="; and (3) just using the DSN. But they all give the same output (see below).
My code in the Web page is:
<%
response.write("Start<br>")
set cn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_test"
' This is an ODBC connection DSN, Windows authentication
' Platform: 32/64 bit; Driver: SQL Server Native Client 10.0
' 1st solution
'cn.ConnectionString = "Provider=SQLOLEDB; Server=(local); Database=sample"
response.write("Ready to open connection<br>")
'cn.Open
' 2nd solution
'cn.Open "DSN=SSNC10UserEnvy360"
' 3rd solution
cn.Open "SSNC10UserEnvy360"
response.write("Connection Object Opened<br>")
cmd.ActiveConnection = cn
cn.close
response.write("Connection is closed<br>")
%>
Output in browser is the following generic message (even though I've set IIS to "detailed"** for this Web site):
Start
Ready to open connection
An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.
What am I doing wrong that I can't connect??