The CONNECT statement
establishes a connection with the DBMS. You establish a connection
to send DBMS-specific SQL statements to the DBMS or to retrieve DBMS
data. The connection remains in effect until you issue a
DISCONNECT statement
or terminate the SQL procedure.
Follow these steps to
connect to a DBMS using the SQL pass-through facility.
-
Initiate a PROC SQL
step.
-
Use the SQL pass-through
facility CONNECT statement, identify the DBMS (such as Oracle or DB2),
and assign an (optional) alias.
-
Specify any attributes
for the connection such as SHARED or UNIQUE.
-
Specify any arguments
that are needed to connect to the database.
The CONNECT statement
is optional for some DBMSs. However, if you do not specify it, the
default values for all database connection arguments are used.
Any return code or message
that the DBMS generates is available in the SQLXRC and SQLXMSG macro
variables after the statement executes. See
Macro Variables for Relational Databases for more information about these macro variables.