mercredi 9 décembre 2020

ASP Classic can't connect to SQL server

Anybody know anything about ASP Classic and MS SQL?

TLDR version: ASP classic script suddenly can't get a connection to MS SQL Server running on the same box.

Longer version:
I'm working on an old website for a customer. The website was moved to a Amazon EC2 instance a while back and runs on Windows Server 2012, IIS 8, MS SQL Server 2012, but still uses the old ASP Classic scripts in the website for database access.

The website with the ASP scripts and the SQL Server are on the same VM so it's not trying to go across a network connection or anything.

It's been working reliably for years, but today the VM rebooted for an update, and since then the web pages cannot access the SQL database. The ASP script has these lines to connect:

Code:

set cnn = server.createobject("ADODB.connection")
 cnn.open "PROVIDER=MSDASQL;DRIVER={SQL Server};SERVER=servername;DATABASE=dbname;UID=username;PWD=password;"

The servername, dbname, username, and password are all the same as they have been for years, and I've verified they are correct. The username and password can be used to log into the MS SQL Server Management Studio with no problem, the data base exists and can be looked at or updated within Management Studio.

The SQL error log contains this:

Code:

Logon      Error: 18456, Severity: 14, State: 38.
Logon      Login failed for user 'username'. Reason: Failed to open the explicitly specified database 'dbname'. [CLIENT: <named pipe>]

Now for the dumb questions. From what I can tell the "PROVIDER=MSDASQL" in the connection string means it's using an ODBC driver to access the SQL server. But I'm not sure and can't quite figure out how to even know if the OBDC driver is loaded. In MS SQL Management Studio I do see "MSDASQL" under "Providers". Is that all I need?

Can somebody help me understand how ASP talks to SQL, and where to look for the problem? And if my problem ASP not talking to SQL, or has something wrong in the SQL setup?

Thanks!


via International Skeptics Forum https://ift.tt/3mZHCqn

Aucun commentaire:

Enregistrer un commentaire