472,993 Members | 3,209 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

Windows Service Login Failed when accessing SQL.



I have a problem for a Windows Service to login on an SQL server (different
machine) - neither Windows Authentication nor SQL Authentication worked.
LOGIN FAILED FOR USER sa (for example).

If SQL Server is on the same PC of the Windows Service the connection works
OK.

The same code works in a Windows Form using same user and authentication
methods to the SQL Server on a different machine.

Thanks for any help!

Evan Camilleri
Nov 21 '05 #1
3 3456
The SQL Auth. should work if the connect string is correct. Also check that
the Authentication for the target SQL Server is set to "SQL Server and
Windows" and not "Windows only".
Windows Auth. will give you a problem if the service runs under the Local
System account (local for the computer with the service installed), it is
unknown to the remote SQL Server. To get this to work, right click on the
service and change the Log On account of the service to be some network
account that has rights on the local computer as well as the SQL Server.

"Evan Camilleri" <ev**@holistic.com.mt.nospam> wrote in message
news:#2**************@TK2MSFTNGP12.phx.gbl...


I have a problem for a Windows Service to login on an SQL server (different machine) - neither Windows Authentication nor SQL Authentication worked.
LOGIN FAILED FOR USER sa (for example).

If SQL Server is on the same PC of the Windows Service the connection works OK.

The same code works in a Windows Form using same user and authentication
methods to the SQL Server on a different machine.

Thanks for any help!

Evan Camilleri

Nov 21 '05 #2
I tried already using 'Log On Account' and still in vain!
The same code does NOT give problems if used in Windows Forms.
I even tried SQL Authentication and it works in Windows Forms but NOT in
Windows Service.

Evan Camilleri
"Chris Botha" <ch***********@AT.h.o.t.m.a.i.l.com> wrote in message
news:es**************@TK2MSFTNGP15.phx.gbl...
The SQL Auth. should work if the connect string is correct. Also check
that
the Authentication for the target SQL Server is set to "SQL Server and
Windows" and not "Windows only".
Windows Auth. will give you a problem if the service runs under the Local
System account (local for the computer with the service installed), it is
unknown to the remote SQL Server. To get this to work, right click on the
service and change the Log On account of the service to be some network
account that has rights on the local computer as well as the SQL Server.

"Evan Camilleri" <ev**@holistic.com.mt.nospam> wrote in message
news:#2**************@TK2MSFTNGP12.phx.gbl...


I have a problem for a Windows Service to login on an SQL server

(different
machine) - neither Windows Authentication nor SQL Authentication worked.
LOGIN FAILED FOR USER sa (for example).

If SQL Server is on the same PC of the Windows Service the connection

works
OK.

The same code works in a Windows Form using same user and authentication
methods to the SQL Server on a different machine.

Thanks for any help!

Evan Camilleri


Nov 21 '05 #3
Solved

The problem was stiupid. The database is named CRM on the localhost and
CRM2003 on the server

:(

Maybe as message Database not found would have been more ideal instead of
login fails!
Thanks anyway.

Evan
"Evan Camilleri" <ev**@holistic.com.mt.nospam> wrote in message
news:u6**************@TK2MSFTNGP12.phx.gbl...
I tried already using 'Log On Account' and still in vain!
The same code does NOT give problems if used in Windows Forms.
I even tried SQL Authentication and it works in Windows Forms but NOT in
Windows Service.

Evan Camilleri
"Chris Botha" <ch***********@AT.h.o.t.m.a.i.l.com> wrote in message
news:es**************@TK2MSFTNGP15.phx.gbl...
The SQL Auth. should work if the connect string is correct. Also check
that
the Authentication for the target SQL Server is set to "SQL Server and
Windows" and not "Windows only".
Windows Auth. will give you a problem if the service runs under the Local
System account (local for the computer with the service installed), it is
unknown to the remote SQL Server. To get this to work, right click on the
service and change the Log On account of the service to be some network
account that has rights on the local computer as well as the SQL Server.

"Evan Camilleri" <ev**@holistic.com.mt.nospam> wrote in message
news:#2**************@TK2MSFTNGP12.phx.gbl...


I have a problem for a Windows Service to login on an SQL server

(different
machine) - neither Windows Authentication nor SQL Authentication worked.
LOGIN FAILED FOR USER sa (for example).

If SQL Server is on the same PC of the Windows Service the connection

works
OK.

The same code works in a Windows Form using same user and authentication
methods to the SQL Server on a different machine.

Thanks for any help!

Evan Camilleri



Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Al | last post by:
I have a single project that contains 8 different windows services. There is a seperate installation project in the solution for the Windows Services. Both projects build fine with no errors. The...
6
by: Bijesh | last post by:
Hi All, I've developed a Windows Service that acts as a remoting server (.NET Remoting). The client(user) is able to connect to the server and start a program by giving the executable path of...
1
by: Paul | last post by:
Hi My web page is accessing a SQL DB to display some data. It works fine using login/password security on the sql server database, but I'm trying to use WIndows authenication and I get the...
1
by: Ibrahim Mohamed El-Ganady | last post by:
Mr : I have proplem with Visual stdio 2003 and Windows2003 Enterprise Server , when I developed web application using ASP.Net (VB) that establish connection to SQL Server database the following...
4
by: Andy Baker | last post by:
I have an Windows forms application written in VB.NET that uses a SQL Server 2000 back end database with Windows authentication. There is no problem accessing the database from my application, or...
3
by: =?Utf-8?B?RGFuZGFuIFpoYW5n?= | last post by:
Now I have a web application, a web service and a SQL Server database. The Web application will invoke the web service, the web service invokes the SQL Server stored procedure. I let the web...
1
by: igor | last post by:
I recently attempted to incorporate an OCX into a .net windows service using .net framework 1.1 The ocx failed to perform as expected, meaning the OCX events failed to execute. I specifed the...
0
by: Taduri | last post by:
Hi, I am creating a windows service that will process exe file( Developed in VB and connects to database using DSN and sa/master login). When service process exe I am getting Database (Sql Server...
1
by: eblackmo | last post by:
I have a test network consisting of four servers running windows 2003 server R2 SP2. I have set up a domain which functioned correctly for about a day and a half until the other servers decided they...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.