Jak uzależnić proces od MSSQL ?

0

Cześć, szukałem w necie, ale nie za wiele znalazłem.
Widzę, że proces ma takie coś jak Dependencies. Domyślam się, że tego muszę użyć.

Jednak na liście procesów, które mi pokazał nie znalazłem nic wspólnego z MSSQL.
Więc jak zrobić, żeby proces wystartował nie wcześniej niż MSSQL Server?

0

Nie wiem po co Ci to. Ale jesli chodzi Ci o to żeby Twoj app wystartowal juz jak sie DB engine uruchomi to ... kiedys kiedys stosowalem proste, acz skuteczne rozwiazanie oparte na TTimer. Lacze sie do bazy pare razy. Zakladam ze Db mogl sie jeszcze nie uruchomic. Cala sprawa sprowadza sie do For'a i try except'a.

b

0
b0bik napisał(a)

Nie wiem po co Ci to. Ale jesli chodzi Ci o to żeby Twoj app wystartowal juz jak sie DB engine uruchomi to ... kiedys kiedys stosowalem proste, acz skuteczne rozwiazanie oparte na TTimer. Lacze sie do bazy pare razy. Zakladam ze Db mogl sie jeszcze nie uruchomic. Cala sprawa sprowadza sie do For'a i try except'a.
b

No wiem, że tak można, ale myślałem, że jest jakieś lepsze rozwiązanie...

0

masz na myśli nie proces, a serwis. serwis jest procesem, ale proces nie jest serwisem.

google, msdn: http://msdn.microsoft.com/en-us/library/ms810435.aspx:
''Example 2

The following example creates the service on the local computer as an auto-start service that runs in its own process. It has dependencies on the TDI group and on the NetBIOS service. Notice that you must add quotes around the list of space-separated dependencies.

sc create NewService binpath= c:\nt\system32\NewServ.exe type=own start=auto depend="+TDI Netbios"''

http://msdn.microsoft.com/en-us/library/ms681987(VS.85).aspx:

BOOL WINAPI ChangeServiceConfig(
  __in       SC_HANDLE hService,
  __in       DWORD dwServiceType,
  __in       DWORD dwStartType,
  __in       DWORD dwErrorControl,
  __in_opt   LPCTSTR lpBinaryPathName,
  __in_opt   LPCTSTR lpLoadOrderGroup,
  __out_opt  LPDWORD lpdwTagId,
  __in_opt   LPCTSTR lpDependencies,
  __in_opt   LPCTSTR lpServiceStartName,
  __in_opt   LPCTSTR lpPassword,
  __in_opt   LPCTSTR lpDisplayName
);

zwróć uwagę na lpDependencies - "A pointer to a double null-terminated array of null-separated names of services or load ordering groups that the system must start before this service can be started. (Dependency on a group means that this service can run if at least one member of the group is running after an attempt to start all members of the group.) Specify NULL if you are not changing the existing dependencies. Specify an empty string if the service has no dependencies.

You must prefix group names with SC_GROUP_IDENTIFIER so that they can be distinguished from a service name, because services and service groups share the same name space."

1 użytkowników online, w tym zalogowanych: 0, gości: 1