Re: Connecting to SQL from a Windows Service
- From: "Rick Byham, \(MSFT\)" <rickbyh@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 20 Mar 2008 09:11:07 -0700
When you are connected to SQL Server as "Windows (XP Pro) as an Admin" and you run the query:
USE master
GO
SELECT * FROM syslogins
WHERE name = 'NT AUTHORITY\SYSTEM'
GO
Does it return a row for that login?
And most of the values should look like your login: denylogin = 0, hasaccess = 1, dbname is probably master or your desired database.
And after login, does the 'NT AUTHORITY\SYSTEM' has access to the correct database as a user?
Also, You can try turning on login auditing in SQL Server and then check the SQL Server error log. Maybe you will see more info about the login attempt.
--
Rick Byham (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights.
"RML" <RML@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:E21B3350-9477-4DCE-8E64-3690FFB2BAD3@xxxxxxxxxxxxxxxx
Hi all, I have written a Windows Service that attempts to connect to an SQL
2005 Express Database when started. The login always fails. The login uses
Windows Authentification (NT AUTHORITY/SYSTEM user).
I also tried connecting using the "sa" SQL Server login, and it still fails.
If I log into Windows (XP Pro) as an Admin, and manually start the service,
it connect Ok.
I thought that maybe the SQL Server service "MSSQL$SQLEXPRESS" may not be
started yet when my service attempts to connect, but the Evetn Log show it is
started before my service starts. Also, my service is Dependant on
MSSQL$SQLEXPRESS.
Can anyone point me in the right direction.
RML
.
- Follow-Ups:
- Prev by Date: Re: BULK INSERT incorrect numeric values
- Next by Date: Re: Connecting to SQL from a Windows Service
- Previous by thread: Re: BULK INSERT incorrect numeric values
- Next by thread: Re: Connecting to SQL from a Windows Service
- Index(es):
Relevant Pages
|