The user is not associated with a trusted SQL Server

G

gnewsgroup

OK, I know this has been a popular question from newbies. But, please
don't haste to reply yet.

I've googled and tested for a few hours, and cannot have this problem
resolved.

I have followed articles on the web and enabled "SQL Server and
Windows Authentication" for my SQL Server 2005. But, it does not
solve my problem. (It is actually my default setting for my SQL
Server)

I have been developing a web application at work just fine. I wanted
to work on it this weekend at home, so I brought everything back and
dumped it onto my home PC running WinXP SP2 and SQL Server 2005.

I am using the same connection string as follows:

"Data Source=localhost;Initial Catalog=MyDatabase; User Id=myusername;
Password=secret;";

The database has been made to be compatible with SQL SERVER 2000.

I've added myusername to the database, and assigned it a dbowner
role.

Well, I can login as myusername using SQL Server Authentication and
view my database tables and do everything else, that means this
credential is fine with the database.

But, my application just cannot connect to this database, no matter
what. The error message says:

Exception Details: System.Data.SqlClient.SqlException: Login failed
for user 'myusername'. The user is not associated with a trusted SQL
Server connection.

Besides not enabling SQL Server Authentication, which is out of the
equation for my case, what else might be causing this problem?

Thank you!
 
D

derhamfamily

Is this an asp.net app? I might be trying to connect using the local
machine's ASPNET account.
 
N

Norman Yuan

gnewsgroup said:
OK, I know this has been a popular question from newbies. But, please
don't haste to reply yet.

I've googled and tested for a few hours, and cannot have this problem
resolved.

I have followed articles on the web and enabled "SQL Server and
Windows Authentication" for my SQL Server 2005. But, it does not
solve my problem. (It is actually my default setting for my SQL
Server)

I have been developing a web application at work just fine. I wanted
to work on it this weekend at home, so I brought everything back and
dumped it onto my home PC running WinXP SP2 and SQL Server 2005.

I am using the same connection string as follows:

"Data Source=localhost;Initial Catalog=MyDatabase; User Id=myusername;
Password=secret;";


Where do you use this ConnectionString?

The database has been made to be compatible with SQL SERVER 2000.

I've added myusername to the database, and assigned it a dbowner
role.

Well, I can login as myusername using SQL Server Authentication and
view my database tables and do everything else, that means this
credential is fine with the database.

But, my application just cannot connect to this database, no matter
what. The error message says:


What is your application's ConnectionString? I'd bet it is not EXACTLY the
same as the one you showed above, according to the error, is it?

If your application is ASP.NET app and you connect the app to SQL Server via
trusted connection (Windows authetication), then you need to know which user
account is running the application and then make that user account has a
matched SQL Server login and database user (if you do know how to set up SQL
Server login and database user (make a SQL Server login/database use as
dbowner maybe simple, but it would be severe security hole, if the database
is share by many users).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top