Page 1 of 1

HOW CAN I START ADS SERVICE ON A GIVEN SERVER IF NOT STARTED

Posted: Sun Aug 07, 2016 4:21 am
by unixkd
HI ALL

HOW CAN I START ADS SERVICE ON A GIVEN SERVER IF NOT STARTED

If my application returns error 6420 I want to be able to start the ADS service and try to reconnect again.

Thanks.

Joe

Re: HOW CAN I START ADS SERVICE ON A GIVEN SERVER IF NOT STA

Posted: Sun Aug 07, 2016 6:30 am
by Cliff Wiernik
From the services management tool for windows:

From command line: enter services.msc and press enter
Or Control Panel - Administrative Tools - Service

Select Advantage Database server and click restart.

Re: HOW CAN I START ADS SERVICE ON A GIVEN SERVER IF NOT STA

Posted: Sun Aug 07, 2016 6:43 am
by mzipkin
Joe,

Sounds like you want to do this under program control...
Although I've not tried this myself, it looks like you'd need to perform the following steps using Windows API calls:

1) OpenSCManager, to open the service control manager on the desired machine
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

2) OpenService, to get a handle to the desired service.
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

3) StartService
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

4) CloseServiceHandle (for the handle returned in #2)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

5) CloseServiceHandle (for the handle returned in #1)

Regards,

Mark

Re: HOW CAN I START ADS SERVICE ON A GIVEN SERVER IF NOT STA

Posted: Sun Aug 07, 2016 10:04 am
by bwolfsohn
Once you have ads running and set-up on a server, it should be set to start automatically when the server reboots. if you're getting 6420's, something is wrong with your set-up.. in over 10 years of running ads, we haven't had more than 1 or 2 instances of the ads server going down...

Re: HOW CAN I START ADS SERVICE ON A GIVEN SERVER IF NOT STA

Posted: Sun Aug 07, 2016 10:15 pm
by unixkd
I use the ADS API below to check if ADS service is running:

nRetVal := AdsIsServerLoaded(LEFT(DC_Path(AppName(.t.)),2), @nServerLoaded )

IF nRetVal is 6420, then ADS service is not running and I would like to start it.

Thanks

Joe

Re: HOW CAN I START ADS SERVICE ON A GIVEN SERVER IF NOT STA

Posted: Mon Aug 08, 2016 7:38 am
by Cliff Wiernik
Why would the ADS server not normally be loaded. I like Brian have normally never seen that to be an issue.

Re: HOW CAN I START ADS SERVICE ON A GIVEN SERVER IF NOT STA

Posted: Mon Aug 08, 2016 11:36 am
by unixkd
It has happened in 2 of my clients sites

Joe