Previous Topic Next topic Print topic


DISCONNECT

Closes the connection(s) to a database. In addition, all cursors opened for that connection are automatically closed.

Syntax:

>>---EXEC SQL---DISCONNECT---.-name----.----END-EXEC----><
                             +-ALL-----+
                             +-CURRENT-+
                             +-DEFAULT-+

Parameters:

name The connection name.
ALL Disconnects all connections (including automatic connections made when the INIT option of the SQL Compiler directive is used).
CURRENT Disconnects the current connection. The current connection is either the most recent connection established by a CONNECT statement or a subsequent connection set by a SET CONNECTION statement.
DEFAULT Disconnects the default connection. This is the connection made by a CONNECT statement which did not specify a connection name.

Example:

EXEC SQL CONNECT TO "srv1" AS server1 USER "sa." END-EXEC
EXEC SQL CONNECT TO "srv2" AS server2 USER "sa." END-EXEC
...
EXEC SQL DISCONNECT server1 END-EXEC
EXEC SQL DISCONNECT server2 END-EXEC.
Previous Topic Next topic Print topic