Disconnecting from a server

The connections your application program establishes remain open until you explicitly close them or your program terminates. Use the disconnect statement to close a connection between the application program and Adaptive Server.

The statement’s syntax is as follows:

exec sql disconnect {connection_name | current | DEFAULT | all}

where:

The disconnect statement performs the following, in order:

  1. Rolls back the current transactions ignoring any established savepoints.

  2. Closes the connection.

  3. Drops all temporary objects, such as tables.

  4. Closes all open cursors.

  5. Releases locks established for the current transactions.

  6. Terminates access to the server’s databases.

disconnect does not implicitly commit current transactions.

WARNING! Before the program exits, make sure you perform an exec sql disconnect or exec sql disconnect all statement for each open connection. In some configurations, Adaptive Server may not be notified when a client exits without disconnecting. If this happens, resources held by the application will not be released.