Print Page | Close Window

classic asp to sql 2014 connection string

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=31180
Printed Date: 05 June 2023 at 9:08am
Software Version: Web Wiz Forums 12.06 - https://www.webwizforums.com


Topic: classic asp to sql 2014 connection string
Posted By: RealSalsafreak
Subject: classic asp to sql 2014 connection string
Date Posted: 03 April 2015 at 9:30pm
Hi,

i have sql server 2014 now, but I have no idea what the provider should be:
<code><%
Dim ConnectString, conn
'ConnectString = "Provider=SQLNCLI11;Server=myserver\DENALI;Database=DENALI;Uid=sql_user;Pwd=sql_pass;Trusted_Connection=No;DataTypeCompatibility=80"
ConnectString = "Provider=SQLNCLI10.1;Server=myserver\KATMAI;Database=KATMAI;Uid=sql_user;Pwd=sql_pass;Trusted_Connection=No;DataTypeCompatibility=80"

Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString

%></code>

Does anyone got it working, classic asp with sql 2014?

Kind regards!




Replies:
Posted By: WebWiz-Bruce
Date Posted: 04 April 2015 at 11:15am
The simplest way is to use the SQLOLEDB driver which will work with all versions of SQL Server as far as I am aware with Classic ASP.

ConnectString = "Provider=SQLOLEDB;Server=myserver\KATMAI;User ID=sql_user;Password=sql_pass;Database=KATMAI;"


-------------
http://www.facebook.com/WebWiz" rel="nofollow - Find Web Wiz on Facebook
http://twitter.com/WebWizUK" rel="nofollow - Follow Web Wiz on Twitter


Posted By: RealSalsafreak
Date Posted: 07 April 2015 at 7:33pm
I changed the connection string as you suggested and i enabled named pipes, but still i get an error:
Microsoft SQL Server Native Client 10.0 error '80004005'

SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. 

/scripts/connect.asp, line 7 


Any suggestions what i can try next?




Posted By: WebWiz-Bruce
Date Posted: 08 April 2015 at 7:46am
Classic ASP uses TCP/IP to connect to the database server.

Did you install SQL Server in mixed mode in order to allow TCP/IP connections?


-------------
http://www.facebook.com/WebWiz" rel="nofollow - Find Web Wiz on Facebook
http://twitter.com/WebWizUK" rel="nofollow - Follow Web Wiz on Twitter


Posted By: RealSalsafreak
Date Posted: 08 April 2015 at 9:59am
Yes, it is mixed mode and also tcp/ip is enabled


Posted By: WebWiz-Bruce
Date Posted: 08 April 2015 at 12:54pm
It looks like it is failing to find the server and/or instance name.

Check that you have the server name and instance name correct and that TCP/IP is enabled in SQL Server for the IP address you are connecting on. Also check the firewall has port 1433 open.


-------------
http://www.facebook.com/WebWiz" rel="nofollow - Find Web Wiz on Facebook
http://twitter.com/WebWizUK" rel="nofollow - Follow Web Wiz on Twitter


Posted By: addseo1115
Date Posted: 04 May 2015 at 4:18am
Thanks for the useful recommends. Your post is so nice. LOL


Posted By: lyndaeldo
Date Posted: 21 September 2015 at 8:30am
Hope this will help you..... http://asp.net-inations.com/-providers/sql-connection.htm - Asp.Net Connectionstring
 
Lynda


Posted By: RealSalsafreak
Date Posted: 03 July 2017 at 2:15pm
I migrated to sql 2016 and it seems the connection is doing well, only i get no data back from the database. Here's my test script 
<code>

<%
Dim objConn
Dim strSQL
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT top 10 * FROM factuur"
objConn.Open "Provider=SQLOLEDB;Data Source=MYSERVER;User ID=sql_user;Password=password;Database=DBNAME;"
If objConn.errors.count = 0 Then
Response.Write "Connected OK"
else 
Response.Write "Connected NOT OK"
End If

objRS.Open objRS, objConn

If Not objRS.EOF Then
Response.Write objRS.RecordCount
Else
response.write "niks" 
End If
objRS.close
Set objRS=Nothing
objConn.close
Set objConn=Nothing
%>
</code>

then i get the message that my connection is ok, but i see no record count: Connected OKAn 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.

Am i missing something here?






Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.06 - https://www.webwizforums.com
Copyright ©2001-2023 Web Wiz Ltd. - https://www.webwiz.net