RDB/VMS SQL CONNECT — VMS RDB_4.2
CONNECT --+
+---------+
+-+---------------------------------------+--+
+-> TO ----> runtime-options (1) -------+ |
+--------------------------------------------+
+-+---------------------------------------+--+
+-> AS -+---------------------------+---+ |
+-> runtime-options (2) ----+ |
+--------------------------------------------+
++------------------------------------------+-+
++-+-> CATALOG --> runtime-options (3) +-+-+ |
| +-> SCHEMA ---> rumtime-options (4) + | |
+--------------- , <--------------------+ |
+---------------------------------------------+
+-+---------------------------------------+----> ;
+-> NAMES runtime-options (5) ----------+
runtime-options
--+---> 'literal' --------------+-->
+---> parameter --------------+
+---> parameter-marker -------+
Additional information available:
More Informationconnect expression
More Information
The CONNECT statement associates an SQL environment with a connection and specifies a connection name for the association. An SQL environment is one or more databases that can be attached or detached as a unit. When you execute a procedure, the databases that you specify in DECLARE ALIAS or ATTACH statements are the SQL environment for that procedure. You can use the CONNECT statement to add another database to the current SQL environment or to substitute a different group of databases for the default SQL environment. You can issue two different CONNECT statements that attach to the same database, but each attach is unique. Each CONNECT statement creates its own implicit transaction. You can use the connection name to specify a global database context when writing SQL modules for concurrent access to one or more databases. Once you have specified a connection name in a CONNECT statement, you can refer to that name in subsequent SET CONNECT statements. You can use a SET CONNECT statement to specify a new environment for a procedure to run against without having to detach and recompile queries.
connect expression
connect-expression =
---+--> DEFAULT --------------------+->
++-> db-specification -------+---+
+-------- , <---------------+
db-specification =
-+-> ALIAS alias ---------------------------+
| +----------------------------------+
| +-+-----------------------------+-----+->
| ++-> FILENAME -> file-spec -+-+ |
| +-> PATHNAME -> path-name -+ |
+-> ATTACH attach-expression -----------------+
Additional information available:
More information
The TO runtime-options specifies the database environment. You can supply a parameter marker from dynamic SQL, a host language variable from a precompiled SQL program, a parameter from an SQL module langauge module, or a string literal. The argument that you supply must be a character string that contains a connect expression that is interpreted at run time. The db-specification specifies one or more valid aliases. An alias, which identifies a particular database, is valid only if that database is either declared in any of the modules in the current application or attached with the ATTACH statement. You can issue an ATTACH statement as part of the db-specificaiton.