473,411 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 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 3479
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.