Re: Windows Services and SQL Server



On May 4, 7:58 am, Diogo Alves <DiogoAl...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
yes there is a reason...

Where planning in the future use more than one database type... maybe oracle
and/or mysql

Since there is that option in the future we prefer to use odbc

"Peter Bromberg [C# MVP]" wrote:



If you are using managed code, is there any reason why you can't use the
SqlClient class with a regular SQL Server login? e.g.,
server=myserver;database=dbname;uid=user;pwd=password;
--Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net

"Diogo Alves" wrote:

Greetings everyone,

I am trying to access my SQL Server 2005 database with a windows service,
the problem is that I can't access it!

It says ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login
failed for user 'ONEWORLD\N5DALVES$'.

ONEWORLD is my domain, N5DALVES is my computer name.... the $ appears there
like magic...

in the SQL Server I don't have that user... I have ONEWORLD\DALVES...
that's my username in the intranet...

How can I avoid this? I tried to use this connection string:

DSN=MyDataSource;Uid=TimeFiveUser;Pwd=_TimeFiveUser_;

I'm using ODBC Drivers- Hide quoted text -

- Show quoted text -

To answer your question, it looks like you need to add the oneworld
\n5dalves$, because you're running the service as local system (or
local service) which will use the machine login. Your other option is
to run the service under a differnt user account which does have
permission to the sql server.

.



Relevant Pages

  • Re: 18456 Login failed for user NT AUTHORITYSYSTEM
    ... No, not using fulltext Searching. ... problem and had ruled it out but had not though about tracing the account. ... > system and is unable to connect to SQL server. ... > SQLSERVERAGENT - but I'm sure it's not running under local system.) ...
    (microsoft.public.sqlserver.server)
  • Re: .udl file?
    ... OK button and then seeing the "SQL Server Login" prompt, ... Connection" checkbox is checked on which would explain why the initial ...
    (microsoft.public.access.externaldata)
  • Re: Debugging Windows Service
    ... I am writing a Windows Service that works with SQL Server. ... I want to be able to debug it, ... it looks as if Local System does not have access to SQL Server, ...
    (microsoft.public.dotnet.general)
  • Re: sqlserver connection - need help desperately!
    ... > You are connecting to a remote SQL Server ... > The SQL Server accepts both Windows and SQL Server authentication. ... > SQL Server login that's authorized to use your database. ... > the ASP.NET account in the SQL Server. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Authenticating in SQL Server via MS Access 2002
    ... account and this account will be used by Access to authenticate with ... > 1.Database is on SQL Server 2000 ... > SQL using Windows authentication. ... > it is then that they are asked for their SQL Server login. ...
    (microsoft.public.access.externaldata)