Progress
Embedded SQL-92
Guide and Reference


DISCONNECT Statement

The DISCONNECT statement terminates the connection between an application and the database to which it is connected:

SYNTAX
EXEC SQL
  DISCONNECT { ’connection_name’ | CURRENT | ALL | DEFAULT } ; 

connection_name

Disconnects the named database. If there is also an established connection to the DEFAULT database, the connection to the DEFAULT database becomes the current connection. If there is no DEFAULT database, there is no current connection after the SQL engine processes the DISCONNECT.

CURRENT

Disconnects the CURRENT database. f there is also an established connection to the DEFAULT database, the connection to the DEFAULT database becomes the current connection. If there is no DEFAULT database, there is no current connection after the SQL engine processes the DISCONNECT.

ALL

Disconnects all established connections. After you issue DISCONNECT ALL, there is no CURRENT connection.

DEFAULT

Terminates the connection to the DEFAULT database. If this connection is the current connection, there is no current connection after this DISCONNECT statement is executed.

EXAMPLES

The first example illustrates CONNECT TO AS ’connection_name’ and DISCONNECT ’connection_name’:

EXEC SQL
     CONNECT TO ’progress:T:localhost:6745:salesdb’ AS ’conn_1’ ;
/*
**  C Language and embedded SQL-92 application processing against the
**  database in the connect_string
*/
   .
   .
   .
EXEC SQL
     DISCONNECT ’conn_1’ ; 

This example illustrates CONNECT TO DEFAULT and DISCONNECT DEFAULT:

EXEC SQL
    CONNECT TO DEFAULT ;
/*
**  C Language and embedded SQL-92 application processing against the
**  database in the connect_string
*/
   .
   .
   .
EXEC SQL
    DISCONNECT DEFAULT ; 

When you specify the ALL option, all established connections are disconnected. After you issue DISCONNECT ALL there is no current connection. For example:

EXEC SQL
     DISCONNECT ALL; 

The following example illustrates these steps:


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095