Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : Database Access : Disconnecting databases
 

Disconnecting databases

By default, OpenEdge disconnects all databases at the end of a session. You can explicitly disconnect a database with the DISCONNECT statement, which has the following syntax:

Syntax

DISCONNECT logical-database-name
The logicaldatabasename represents the logical name of a connected database. It can be an unquoted string, a quoted string, or a character expression.
A DISCONNECT statement does not execute until all active procedures that reference the database end or stop. In the following procedures, the mydb database is not disconnected until the end of the i-subproc1.p procedure:
i-mainprc1.p
CONNECT -db mydb -1.
RUN i-subproc1.p.
i-subproc1.p
RUN i-subproc2.p.

FOR EACH mydb.Customer
  EXCLUSIVE-LOCK:
  UPDATE Customer.Name Customer.Address Customer.City Customer.State
    Customer.PostalCode.
END.
i-subproc2.p
DISCONNECT mydb.