I'm running SQL Server 2000 under Windows 2000 Advanced Server.
Authentication is set up as Windows Only. The Administrator account for the
server is set up as an SQL user (this is done by default). I'm using the
following ASP code to log onto a sample database (for which the
Administrator has been granted access):
strConnectionString = "Provider=MSDASQL;DRIVER={SQL Server};" +_
"Server=localhost;database=" + strDBaseName +
";UID=MACHINENAME\Administrator;PWD=password;"
However, I get the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e4d'
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'MACHINENAME\Administrator'. Reason: Not associated with a trusted SQL
Server connection.
I get the same error even if I use Administrator without MACHINENAME. I
even enabled Basic Authentication on the default website, as Microsoft
suggested.
Any ideas why the Administrator is being rejected?
Thanks,
Lisa
Lisa wrote:
> I'm running SQL Server 2000 under Windows 2000 Advanced Server.
> Authentication is set up as Windows Only. The Administrator account
> for the server is set up as an SQL user (this is done by default).
> I'm using the following ASP code to log onto a sample database (for
> which the Administrator has been granted access):
> strConnectionString = "Provider=MSDASQL;DRIVER={SQL Server};" +_
> "Server=localhost;database=" + strDBaseName +
> ";UID=MACHINENAME\Administrator;PWD=password;"
> However, I get the following error:
> Microsoft OLE DB Provider for ODBC Drivers error '80040e4d'
> [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
> 'MACHINENAME\Administrator'. Reason: Not associated with a trusted SQL
> Server connection.
> I get the same error even if I use Administrator without MACHINENAME.
> I even enabled Basic Authentication on the default website, as
> Microsoft suggested.
> Any ideas why the Administrator is being rejected?
> Thanks,
> Lisa
You don't want to do it that way. UserID and Password are only for SQL
Authentication, not Windows Authentication. It looks like your IIS
server is running on the same box as SQL Server (not a great idea for
anything but an internal site). If that's the case, you only need to
specify in the connection string that you are using an Trusted
Connection. No password is required.
Add "TrustedConnection=Yes" to the connection string. It automatically
uses the current connection to Windows to authenticate.
David Gugick
Imceda Software
www.imceda.com
No comments:
Post a Comment