Not associated with a trusted SQL Server connection - Windows Serv

G

Guest

I'm developing a windows service on a workgroup. My database is set up for
Mixed Mode Authentication and I'm logging on using a sql login. I've used sa
and the blank password and I've also created a new user with a password and
tried that as well. The service is running under the local machine account.
All of the code works when I put it in a Windows Forms application, but not
when it runs as a service. I'm using SQL Server 2000 on a Windows XP Pro
machine. Can anyone explain this to me?

The exact message is:
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server
connection.
 
G

Guest

Val,

Can u pl see this post. I have similar problem connecting to a SQL Server
which is configured as mixed mode authentication. So far I never came across
a situation like this but now I am happened to use mixed mode authentication
but to connect using windows authentication. The authentication is working
fine if I specify the username and password in the connection string but I
want to use windows authentication for connections to the server.

Here is the connectionstring that I am using to connect to SQL server using
SQLClient provider.

-----------------------------------------------------------------------------------------
"Data Source=(local);Database=Northwind;Integrated Security=True;
-----------------------------------------------------------------------------------------

Am I missing anything here?

Thanks in advance.
--Kris
 
N

Norman Yuan

Using Windows authentication in SQL server DOES NOT mean that as long as you
logged on to your computer then you can go into SQL Server. It only means
that you do not need supply username/password pair when trying to access SQL
Server, and SQL Server accept who you are as your user account claims.

Important thing for many newbie ( no offence here) to know is security
include authentication and authorization. Authentication only answers who
you are. Authorization gives you proper access privilege base on who you
are.

In your case, when you try to access SQLServer with windows user account,
SqlServer knows who you are. But you ( the user account) may still not have
access right to go to a database. First you need to create SQLServer loggin
that matches your Windows user account or a Windows user group which
includes your user account. Then you need assign database access permission
to this SQL Server loggin. After this, your Windows account then becomes
trusted in the SQLServer.
 
G

Guest

Norman,

Thanks for ur inputs. I checked the user accounts on the SQL server and I
found the UserGroup account to which I belong does already exists on the
server(Builtin/Administrators group). I am trying to connect to sql server
using the logged in account(windows user account).

Hence not sure what else I am missing here.

Thanks in advance.
--Kris
 
N

Norman Yuan

Do you mean the user account you are using is in local Administrators group?
Do you log in using local user account or a domain user account (when you
connected to a network)? Just to verify, create a login in SQL Server for
your local user account in format of "MachineName\UserAccount", and then log
onto your Windows with this account and try to connect to SQL Server.
 
N

Norman Yuan

Another thing I forgot to ask: where are you trying to connect to the SQL
Server from, I mean, which type of application? Windows desktop app or Web
app?
 

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

Top