Dear Entitled,
I've service application written in Delphi 2010 and using SDAC 5.
Unfortunately the service application can not start automatically when I check the application logs that I see cannot login with sa or Windows Authentication.
After connecting to the system I can start it manually.
So... How can I autostart my service application. May be have to start after some other service started. Also I added my service application's Dependencies MSSQL SERVER but nothing changes, Still can not autostart it!!!
Thanks...
Service Application SQL Connection Login Error
-
hmelihkara
- Posts: 21
- Joined: Fri 09 Nov 2007 23:29
-
AndreyZ
-
hmelihkara
- Posts: 21
- Joined: Fri 09 Nov 2007 23:29
Hello,
I already know problem is not related to SDAC.
But do you know any solutions or workarounds about this problem?
Probably a timing problem is occuring, MSSQLSERVER service started, after that MyService application started and try to connect to specific database. I put it to dependencies but still not success. If I login to system via remote desktop and start MyService manually no problem occurs.
Can you offer me any solutions? Cause starting the service everytime if server-restarst or gets unexpected server-shutdowns are very painfull.
Thanks.
PS: I try to give same credentials (Administrator) manually to both MSSQL Service and MyService, but still MyService giving same error on trying to auto-startup.
I already know problem is not related to SDAC.
But do you know any solutions or workarounds about this problem?
Probably a timing problem is occuring, MSSQLSERVER service started, after that MyService application started and try to connect to specific database. I put it to dependencies but still not success. If I login to system via remote desktop and start MyService manually no problem occurs.
Can you offer me any solutions? Cause starting the service everytime if server-restarst or gets unexpected server-shutdowns are very painfull.
Thanks.
PS: I try to give same credentials (Administrator) manually to both MSSQL Service and MyService, but still MyService giving same error on trying to auto-startup.
-
AndreyZ
You can try using the following code:
Code: Select all
procedure TMyServ.ServiceExecute(Sender: TService);
begin
CoInitializeEx(NIL, 0);
while not MSConnection.Connected do
begin
try
MSConnection.Connect;
except
end;
if not MSConnection.Connected then
sleep(1000);
end;
// successfull connection
CoUnInitialize;
end;