somejkuser
somejkuser

Reputation: 9040

Cannot get classic ASP app to connect to database

We have an application which we are attempting to revive that was written in classic ASP in 2010. So far, I've done the following:

Im getting the following error:

2018-01-21 01:36:16 ::1 POST /intranet/process.asp |178|80004005|[Microsoft][ODBC_SQL_Server_Driver][DBNETLIB]SQL_Server_does_not_exist_or_access_denied. 80 - ::1

I noticed in the code theres a file that has a Session config for a database connection that doesnt look the same.

Im not sure what to do at this point. We need to figure out how to connect this database to the application

Heres my web.config.xml in the root:

<configuration>
<appSettings />
<connectionStrings>
    <add connectionString="Server=server\SQLEXPRESS;Database=dbname;User ID=dbuser;Password=dbpass" name="SqlServer" />
</connectionStrings>
</configuration>

Here's my web.config.xml inside the intranet folder which is for an admin area:

<add name="WEB"
    connectionString="Server=server\SQLEXPRESS;Database=dbname;User ID=dbuser;Password=dbpass"
    providerName="System.Data.SqlClient" />

I noticed a file global.asa that has this:

Sub Session_OnStart
       Session("ConnectString") = "Server=adifferentserver;Database=adifferentdatabase;UID=adifferentuser;PWD=adifferentpassword;Driver={SQL Server};"

This is my first time using ASP so you'd have to guide me for what other files you need.

Upvotes: 3

Views: 2594

Answers (1)

user692942
user692942

Reputation: 16671

The global.asa file in Classic ASP acts as an initialisation script it is commonplace to set long-running variables such as Application and Session variables there.

If this file contains a connection string variable then that is the value to change to your migrated database. At the moment process.asp is using Session("ConnectString") and ADODB is trying to locate adifferentserver using the SQL Server provider and failing. Once you correct the connection string using the required provider and server, database combination the page should work.

The other two values come from the web.config which was brought in with IIS 7.0 and above, it's designed for Microsoft .Net and Classic ASP does not know about connection strings configured inside it. The likelihood is there is another web application that uses ASP.Net that was making use of those connection strings.

Upvotes: 1

Related Questions