ALLBASE/SQL Reference Manual (36216-90216)

392 Chapter10
SQL Statements A - D
DISCONNECT
automatic transaction will
not
be started when executing a DISCONNECT statement.
Any connection name associated with a disconnected connection can be reused.
•ADISCONNECT CURRENT statement is equivalent to a RELEASE statement.
Following a RELEASE or DISCONNECT CURRENT command, there is no current
connection until a SET CONNECTION command is used to set the current connection to
another existing connection, or a new connection is established by using the CONNECT,
START DBE, START DBE NEW, or START DBE NEW LOG commands.
Authorization
You do not need authorization to use the DISCONNECT statement.
Example
Connect three times to PartsDBE and once to SalesDBE:
CONNECT TO :PartsDBE AS 'Parts1'
CONNECT TO :PartsDBE AS 'Parts2'
CONNECT TO :PartsDBE AS 'Parts3'
CONNECT TO :SalesDBE AS 'Sales1'
.
.
.
Terminate the connection associated with connection name Parts1:
DISCONNECT 'Parts1'
Terminate the connection associated with the most recently connected DBEnvironment
(the current connection). Following the execution of this statement, SalesDBE is no longer
connected, and no current connection exists:
DISCONNECT CURRENT
Note that another DISCONNECT CURRENT statement at this point would generate an error.
Also any SQL statement that operates on a transaction will fail since there is no current
connection and therefore no current transaction.
Set the current connection to Parts3:
SET CONNECTION 'Parts3'
Terminate the connection associated with the most recently connected DBE (the current
connection). Following the execution of this statement, the Parts3 connection to PartsDBE
no longer exists, and no current connection exists:
DISCONNECT CURRENT
Terminate all established connections. Following this statement, the Parts2 connection to
PartsDBE no longer exists:
DISCONNECT ALL