DISCONNECT
Go Up to Statement and Function Reference (Language Reference Guide)
Detaches an application from a database. Available in gpre
.
DISCONNECT {{ALL | DEFAULT} | dbhandle [, dbhandle] …]};
Argument | Description |
---|---|
|
Either keyword detaches all open databases. |
<dbhandle> |
Previously-declared database handle specifying a database to detach. |
Description: DISCONNECT
closes a specific database identified by a database handle or all databases, releases resources used by the attached database, zeroes database handles, commits the default transaction if the gpre
-manual
option is not in effect, and returns an error if any non-default transaction is not committed.
Before using DISCONNECT
, commit or roll back the transactions affecting the database to be detached.
To reattach to a database closed with DISCONNECT
, reopen it with a CONNECT
statement.
Examples: The following embedded SQL statements close all databases:
EXEC SQL
DISCONNECT DEFAULT;
EXEC SQL
DISCONNECT ALL;
The next embedded SQL statements close the databases identified by their
handles:
EXEC SQL
DISCONNECT DB1;
EXEC SQL
DISCONNECT DB1, DB2;