|
|
Connecting to a Database
Only idents of type
USERandOS_USERcan be used to connect to a Mimer SQL database. A connection is established using a CONNECT statement. For example embedded SQL has the following form:CONNECT TO 'DATABASE' [AS 'CONNECTION_NAME'] USER 'USER_NAME' USING 'password';This statement establishes a connection between the user and a database, see the Mimer SQL Reference Manual, CONNECT, for details.
A connection may be established to any local or remote database, which has been made accessible from the current machine - see the Mimer SQL System Management Handbook, Registering the Database, for details. The database can be specified by name or by using the keyword
DEFAULT.Note: If the keyword DEFAULT is used, a user and password cannot be specified. If you wish to connect to the default database and specify a user and password, specify an empty string ('') for the database.
The database may be given an explicit connection name for use in
DISCONNECTandSET CONNECTIONstatements. If no explicit connection name is specified, the database name is used as the connection name.Changing Connections
An application program may make multiple connections to the same or different databases using the same or different idents, provided that each connection is identified by a unique connection name. In this situation only one connection is active and the other connections are inactive. A connection established by a successful
CONNECTstatement is automatically active.A connection may be made active by the
SET CONNECTIONstatement.SET CONNECTION 'CONNECTION_NAME';Disconnecting
The
DISCONNECTstatement breaks the connection between the user and a database. The connection to be broken is specified as the connection name or as one of the keywordsALL,CURRENTorDEFAULT.DISCONNECT 'CONNECTION_NAME';A connection does not have to be active in order to be disconnected. If an inactive connection is broken, the application still has uninterrupted access to the database through the current (active) connection, but the broken connection is no longer available for activation with
SET CONNECTION.If the active connection is broken, the application program cannot access any database until a new
CONNECTorSET CONNECTIONstatement is issued.Note: The distinction between breaking a connection with DISCONNECT and making a connection inactive by issuing a CONNECT or SET CONNECTION for a different connection is, a broken connection has no saved resources and cannot be reactivated by SET CONNECTION.
The table below summarizes the effect on the connection
con1ofCONNECT,DISCONNECTandSET CONNECTIONstatements depending on the state of the connection.
|
Mimer Information Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 info@mimer.se |
|
|