Microsoft KB Archive/81341

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft SQL Server for OS/2, version 4.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 &quot;shutdown [with nowait]&quot;.

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, &quot;Shutdown Gateway&quot;. 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:

 Send a message to the client notifying that client that the application is shutting down and the client should log out. Issue a srv_senddone to the client with SRV_DONE_FINAL and SRV_DONE_ERROR set. 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.</li></ol>

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. Additional query words: 4.20

Keywords : kbtool SSrvGen

Version : 4.2

Platform : OS/2

Issue type :
 * }