DISCONNECT
- Last Updated: December 12, 2014
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
Terminates the connection between an application and the database to which it is connected.
Syntax
|
Parameters
- connection_name
-
The name of the connection as either a character literal or host variable.
- CURRENT
-
Disconnects the current connection.
- ALL
-
Disconnects all established connections.
- DEFAULT
-
Disconnects the connection to the default database.
Notes
- When
you specify
DISCONNECTconnection_name orDISCONNECT CURRENTand there is also an established connection to theDEFAULTdatabase, the connection to theDEFAULTdatabase becomes the current connection. If there is noDEFAULTdatabase, there is no current connection after the SQL engine processes theDISCONNECT. - The
DISCONNECT DEFAULTstatement terminates the connection to theDEFAULTdatabase. If this connection is the current connection, there is no current connection after thisDISCONNECTstatement is executed.
Example
This
example illustrates CONNECT TO ASconnection_name and DISCONNECTconnection_name:
|
The following example illustrates CONNECT
TO DEFAULT and DISCONNECT DEFAULT:
|
After you issue DISCONNECT ALL there
is no current connection. The following example disconnects all
database connections:
|
The following example illustrates the CONNECT, SET
CONNECTION, and DISCONNECT statements
in combination using these steps:
CONNECT TOconnect_stringASconnection_name, which establishes a connect_string connection to the database in the connect_string; the connection has the name 'conn_1'.CONNECT TO DEFAULT, which establishes a connection to theDEFAULTdatabase and sets this connection current.DISCONNECT DEFAULT,which disconnects the connection to theDEFAULTdatabase.SET CONNECTIONconnection_name, which sets the 'conn_1' connection currentDISCONNECT CURRENT, which disconnects the 'conn_1' connection.
|