Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

DISCONNECT statement [ESQL] [Interactive SQL]

Drops a connection to a database.

Syntax
DISCONNECT [ connection-name | CURRENT | ALL ]
connection-name : 
identifier
| string
| hostvar
Remarks

The DISCONNECT statement drops a connection with the database server and releases all resources used by it. If the connection to be dropped was named on the CONNECT statement, the name can be specified. Specifying ALL will drop all the application's connections to all database environments. CURRENT is the default, and drops the current connection.

Before closing the database connection, Interactive SQL automatically executes a COMMIT statement if the commit_on_exit option is set to On. If this option is set to Off, Interactive SQL performs an implicit ROLLBACK. By default, the commit_on_exit option is set to On.

This statement is not supported in procedures, triggers, events, or batches.

Privileges

None.

Side effects

None.

Standards
  • ANSI/ISO SQL Standard

    DISCONNECT comprises optional ANSI/ISO SQL Language Feature F771. The ability to specify DISCONNECT without a parameter, and the commit_on_exit option, are not in the standard.

Example

The following statement shows how to use DISCONNECT in Embedded SQL:

EXEC SQL DISCONNECT :conn_name

The following statement shows how to use DISCONNECT from Interactive SQL to disconnect all connections:

DISCONNECT ALL;