DISCONNECT statement

Use the DISCONNECT statement to terminate a connection between an application and a database server.

Syntax

(1)
Notes:
  • 1 ESQL/C only
Element Description Restrictions Syntax
connection String that specifies a connection to terminate Connection name that the CONNECT statement assigned Quoted String
connection_var Host variable that holds the name of a connection Must be a fixed-length character data type Language specific

Usage

DISCONNECT terminates a connection to a database server. If a database is open, it closes before the connection drops. Even if you made a connection to a specific database only, the connection to the database server is terminated by DISCONNECT. If DISCONNECT does not terminate the current connection, the connection context of the current environment is not changed.

DISCONNECT is not valid as statement text in a PREPARE statement.

In ESQL/C, if you disconnect with connection or connection_var, DISCONNECT generates an error if the specified connection is not a current or dormant connection.