Classic ASP, problem logging in to SQL Server using Windows Authentication - sql-server

I failed to connect using this connection string
strConnString = "Provider=SQLOLEDB;Initial Catalog=fsw;SERVER=HARDIXP\hardi;Integrated Security=SSPI;"
Microsoft OLE DB Provider for ODBC
Drivers (0x80004005) [Microsoft][ODBC
SQL Server Driver][DBMSLPCN]SQL Server
does not exist or access denied.
I can connect fine using SQL Server Management Studio. On the "Connect to Server" dialog, I have
Server Name: HARDIXP
Authentication: Windows Authentication
After it is connected, the server looks like this
HARDIXP (SQL Server 10.0.2531 - HARDIXP\hardi)
If I don't specify the server name, the error will be
Microsoft OLE DB Provider for SQL
Server (0x80040E4D) Login failed for
user 'HARDIXP\IUSR_GEOFFREYXP'.
Note that it is trying a different user, probably because the database was first set up for Geoffrey, not Hardi.
How can I connect to my local SQL Server from this Classic ASP code?
EDIT: I am on Windows XP, IIS 5.1

Assuming this is running on windows.
The ASP process needs to be running as a windows authenticated user that has access to the
database. Just set the application pool on the website to have this identity's credentials.

Related

How to connect to Microsoft SQL Server on a local VM?

I have a Windows 10 VM with SQL Server installed on it. I made sure, that in the Sql Server Configuration Manager the SQL Server Browser is running and the TCP/IP protocol is enabled.
I'm trying to connect to the server with Entity Framework (although I'm not sure if it's relevant) and I'm getting this error:
Cannot connect to SQL Server Browser. Ensure SQL Server Browser has been started.
That's the connection string that I'm using:
Integrated Security=SSPI; Persist Security Info=False; Initial Catalog=<database name>; Data Source=<server name>

Error 18456 while connecting error while trying to connect to SQL Server

I am completely new to databases.. I am doing a small application which needs to connect to a SQL Server database.
My SQL Server is installed on the company server
I am trying to login to SQL Server from my local system
Steps I have tried so far:
Since I have admin credentials to the company server I have logged in and included myself (SQL Server authentication) under security -> logins
So now when I try to connect from my local computer it is giving me "Login failed for user (Microsoft SQL Server error 18456)".
Can any one please help me with this?
Goal: I want to connect to companies server from my local machine.

How to create a new ODBC connection to one remote SQL Server

I'm trying to run an application that I've developped recently. This one uses an ODBC connection to browse a defined database.
I'm trying to execute this app from a remote computer. Using VMWare, I've created a new Windows 7 environment and connected on. After that I've tried to create a new System DSN, but, when I set the logins that I'm using to connect on my local SQL Server 2008 I get
Connection failed: SQLState: '28000' SQL Server Error: 18452
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed. The login
is from an untrusted domain and cannot be used with Windows
authentication.
How may I to deal with this, please?
Thanks a lot!
You will have to use SQL Server authentication to connect or add the local machine to the same domain where the server is.
http://msdn.microsoft.com/en-us/library/ms144284.aspx

sharepoint sql server connection in Windows Azure does not work

I am stuck with a connection from a MS SharePoint Server 2013 to an MS SQL Server 2012 in Windows Azure. I built three VMs: An ADDC, An MSSQL Server and the SharePoint Server. All of them are in the same subnet.
When I am trying connect the SQL Server during the SharePoint setup I am getting following error:
Cannot connect to database master at SQL server at xxx.cloudapp.net. The database might not exist, or the current user does not have permission to connect to it.
The firewall on the SQL Server is deactivated (for testing), The Domain User is listed in database/security/logins and all rights are granted. Perhaps I am missing something.
Connectionstring:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDB;Data Source=MyDB.cloudapp.net

Connect to local SQL Server Express 2008 instance from classic ASP, using SQLOLEDB

I am trying to set up a development testing server, Windows 2008 Server with IIS and SQL Server 2008 Express. The IIS and classic ASP (yeah, supporting antique projects) works fine, including connecting to remote SQL Server 2008 servers, via SQLOLEDB.
However, I fail to connect to the local SQL Server 2008 Express instance. It is installed as an instance (ie, PC-NAME\SQLEXPRESS), and user/pwd authorisation is enabled. I can successfully set up an ODBC entry, so the server works fine. The problem lies in getting the IIS-ASP-SQLOLEDB see the server and connect to it.
Simple connection string, which works on any remote SQL Server 2008 servers, fails at my local express server:
Provider=SQLOLEDB;Data Source=.\SQLEXPRESS;User ID=userName;Password=_pwd_;Database=DbName
The error I get is
SQL Server does not exist or access denied.
The server error log does not contain any trace of unsuccessful login attempt, so I assume there is some problem resolving the data source (because of the instance name?), or the server is somehow inaccessible (protocol, security settings?) from the IIS process.
In SQL Server 2008 express edition it runs on dynamic ports. The solution is just go to properties of the TCP/IP and in the TCP Port just give whatever port you want your SQL Server to listen on.
strConn = "Provider=SQLOLEDB; Network Library=DBMSSOCN; Data Source=.\SQLEXPRESS; Connection Timeout=15;Packet Size=4096; Initial Catalog=DbName; User ID=userName; Password=_pwd_;"
Can you post how you access the connection object via ASP?

Resources