Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SQL-Server login with ASP


Message #1 by bmcelhany@h... on Mon, 23 Jul 2001 18:51:22
Help!

We have a SQL-Server 2000 database set up that we will using for online 

reporting. I have set up a DSN (named "test") that works fine when we use 

Crystal Reports to connect to the database. When I try to create an Active 

Server Page to pull data, however, I get the following error: 



Login failed for user 'sa'. Reason: Not associated with a trusted SQL 

Server connection.



This is the connection string that I'm using in my ASP:



var strConn = "Provider=SQLOLEDB;Data Source=sacsql01;Database=test;User 

ID=sa;Password=";

var objConn = Server.CreateObject("ADODB.Connection");

objConn.Open (strConn);



Any ideas? Thanks in advance!



Brian
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 24 Jul 2001 13:53:06 +1000
My guess is that your server is using Integrated Authentication, not Mixed

Mode authentication. The current NT user context is used to login to the

database, not the crendentials you supply in the connection string.



You need to change your connection string ala:

http://www.able-consulting.com/ADO_Conn.htm#OLEDBProviderForSQLServer

(under the heading "For a Trusted Connection"), and make sure that the

account you are running your website under has sufficient permissions to the

objects in the database.



That said, why are you trying using the sa user to login to your database?!?

Especially with a blank password?!?



Cheers

Ken





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: <bmcelhany@h...>

Subject: [asp_databases] SQL-Server login with ASP





: Help!

: We have a SQL-Server 2000 database set up that we will using for online

: reporting. I have set up a DSN (named "test") that works fine when we use

: Crystal Reports to connect to the database. When I try to create an Active

: Server Page to pull data, however, I get the following error:

:

: Login failed for user 'sa'. Reason: Not associated with a trusted SQL

: Server connection.

:

: This is the connection string that I'm using in my ASP:

:

: var strConn = "Provider=SQLOLEDB;Data Source=sacsql01;Database=test;User

: ID=sa;Password=";

: var objConn = Server.CreateObject("ADODB.Connection");

: objConn.Open (strConn);

:

: Any ideas? Thanks in advance!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Message #3 by "swapna ankireddy" <swapnaankireddy@y...> on Tue, 24 Jul 2001 10:33:04
Hi bmcelhany,

U said that ur having test dsn. In the code u used database as test 

database.dsn and database names r same.





> Help!

> We have a SQL-Server 2000 database set up that we will using for online 

> reporting. I have set up a DSN (named "test") that works fine when we 

use 

> Crystal Reports to connect to the database. When I try to create an 

Active 

> Server Page to pull data, however, I get the following error: 

> 

> Login failed for user 'sa'. Reason: Not associated with a trusted SQL 

> Server connection.

> 

> This is the connection string that I'm using in my ASP:

> 

> var strConn = "Provider=SQLOLEDB;Data Source=sacsql01;Database=test;User 

> ID=sa;Password=";

> var objConn = Server.CreateObject("ADODB.Connection");

> objConn.Open (strConn);

> 

> Any ideas? Thanks in advance!

> 

> Brian

  Return to Index