INF: Network-Independent Way to Shut Down ODS Application

Last reviewed: April 3, 1997
Article ID: Q81341

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:

  1. 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.

  2. 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.

  3. Wait for x seconds to allow users to logout. The choice of x depends on the application programmer and the environment of the application.

  4. 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.


Additional query words: 4.20
Keywords : kbtool SSrvGen
Version : 4.2
Platform : OS/2


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 3, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.