p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   ASP connection string not working (http://p2p.wrox.com/showthread.php?t=29420)

codehappy May 17th, 2005 12:05 PM

ASP connection string not working
 
I have an ASP page that resides on serverA and connects to the database on serverB via an ODBC. I might be doing this wrong... But when I attempt the connection I get either

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

OR

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

This is my connection string that yields the first error:

Application("conn1_ConnectionString") = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=ODBCSrc;Initial Catalog=main;APP=Microsoft Development Environment;WSID=PCWUT-AH3;DATABASE=main;Trusted_Connection=Yes"
        Application("conn1_ConnectionTimeout") = 150
        Application("conn1_CommandTimeout") = 120
        Application("conn1_CursorLocation") = 3

dim Conn ' Create and open our connection
set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionTimeout = Application("conn1_ConnectionTimeout")
Conn.CommandTimeout = Application("conn1_CommandTimeout")
Conn.CursorLocation = Application("conn1_CursorLocation")
Conn.Open Application("conn1_ConnectionString"), Application("conn1_RuntimeUserName") , Application("conn1_RuntimePassword")

This is my connection string that yields the second error:

Application("conn1_ConnectionString") = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=ODBCSrc;Initial Catalog=main;APP=Microsoft Development Environment;WSID=PCWUT-AH3;DATABASE=main"
        Application("conn1_ConnectionTimeout") = 150
        Application("conn1_CommandTimeout") = 120
        Application("conn1_CursorLocation") = 3

dim Conn ' Create and open our connection
set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionTimeout = Application("conn1_ConnectionTimeout")
Conn.CommandTimeout = Application("conn1_CommandTimeout")
Conn.CursorLocation = Application("conn1_CursorLocation")
Conn.Open Application("conn1_ConnectionString")

Any ideas?

Prashant.k.m May 17th, 2005 10:51 PM

hi,

If you are using trusted connection and amnonymous login is enabled, 'NT AUTHORITY\ANONYMOUS LOGON' should have the rights to logon to server.

You can chage this in two ways,
Open the IIS manager, Select the project properties-> Directory security-> Anonymous login -> user name.
1)Add an SQL server user for the same user.
OR
2)Change the user name to Administrator and give the password

Prashant

codehappy May 18th, 2005 08:43 AM

If I did this would it still be using the ODBC? Or is it more trusted? I don't want standard trusted connection because I want the page to point to the ODBC which has the username and password. Is that possible?


All times are GMT -4. The time now is 11:07 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.