Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

DISCONNECT

Description

Terminates the connection between an application and a database environment.

Syntax

DISCONNECT

{ connection_name | ALL | CURRENT | DEFAULT }

connection_name::

{ character_literal | host_variable }

Notes

  • If a connection name is specified it should identify a dormant or current connection. If the connection_name specified is the current connection, the connection to the dormant DEFAULT database, if any, (this connection should have been previously achieved through CONNECT TO DEFAULT) is made the current connection; else no current connection exists.
  • If ALL is specified, all established connections are disconnected. After the execution of this statement, a current connection does not exist.
  • If CURRENT is specified, the current connection, if any, is disconnected. Here too, the connection to the dormant DEFAULT database, if any, (this connection should have been previously achieved through CONNECT TO DEFAULT) is made the current connection; else no current connection exists.
  • If DEFAULT is specified, the DEFAULT connection, if any, is disconnected. If this connection happens to be the current connection, no current connection exists after the execution of this statement.

Examples

DISCONNECT 'conn_1';

DISCONNECT CURRENT;

DISCONNECT ALL;

DISCONNECT DEFAULT;

Authorization

None.

SQL Compliance

SQL-92

Environment

Embedded SQL and interactive

Related Statements

DISCONNECT, SET CONNECTION

TOCIndex