The information in this article applies to:
- Microsoft SQL Server version 4.2 for OS/2
SUMMARY
This article discusses a method to shut down the Open Data Services
(ODS) application in a network independent way. This is analogous to
shutting down SQL Server using the Transact-SQL command "shutdown
[with nowait]".
MORE INFORMATION
The following steps describe the procedure:
- Trap a language message that requests a shutdown. Clients using the
ODS application can issue a command that is intended to shut down
the ODS application; for example, "Shutdown Gateway". The ODS
application can intercept this command and shut down, instead of
passing it over to the remote data source.
In version 4.2, another possible way to handle this is to issue a
remote stored procedure call.
If a shutdown is issued, set a global flag indicating that the ODS
application will be shutting down.
- In the event handlers for SRV_CONNECTION and SRV_LANGUAGE and any
other additional event handlers (if any) that handle the results,
code should be written to check for the global flag (set in step 1)
before doing anything else.
If the global flag is set, do the following:
a. Send a message to the client notifying that client that the
application is shutting down and the client should log out.
b. Issue a srv_senddone to the client with SRV_DONE_FINAL and
SRV_DONE_ERROR set.
c. Issue a srv_event(SRV_DISCONNECT) for that client.
- Wait for x seconds to allow users to logout. The choice of x
depends on the application programmer and the environment of the
application.
- Issue a srv_event(SRV_STOP). This call shuts down all pipe
connections and threads, and calls the user-defined code
SRV_DISCONNECT.
NOTE: If you are running LAN Manager, you can write your application
as a network service and start and stop it using the NET START and NET
STOP commands.
|