The Pass-Through Facility for Relational Databases CONNECT Statement 229
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.
To connect to a DBMS using the Pass-Through Facility, complete the following steps:
1 Initiate a PROC SQL step.
2 Use the Pass-Through Facility’s CONNECT statement, identify the DBMS (such
as Oracle or DB2), and (optionally) assign an alias.
3
Specify any attributes for the connection (such as multiple, shared, unique).
4
Specify any arguments that are needed to connect to the database.
The CONNECT statement is optional for some DBMSs. However, if it is not
specified, the default values for all of the database connection arguments are used.
Any return code or message that is generated by the DBMS is available in the macro
variables SQLXRC and SQLXMSG after the statement executes. See “Macro Variables
for Relational Databases” on page 219 for more information about these macro variables.
Arguments
You use the following arguments with the CONNECT statement:
dbms-name
identifies the database management system to which you want to connect. You
must specify the DBMS name for your SAS/ACCESS interface. You may also
specify an optional alias.
alias
specifies for the connection an optional alias that has 1 to 32 characters. If you
specify an alias, the keyword AS must appear before the alias. If an alias is not
specified, the DBMS name is used as the name of the Pass-Through connection.
database-connection-arguments
specifies the DBMS-specific arguments that are needed by PROC SQL to connect
to the DBMS. These arguments are optional for most databases, but if they are
included, they must be enclosed in parentheses. See the documentation for your
SAS/ACCESS interface for information about these arguments.
connect-statement-arguments
specifies arguments that indicate whether you can make multiple connections,
shared or unique connections, and so on to the database. These arguments enable
the Pass-Through to use some of the LIBNAME statement’s connection
management features. These arguments are optional, but if they are included,
they must be enclosed in parentheses.
CONNECTION= SHARED | GLOBAL
indicates whether multiple CONNECT statements for a DBMS can use the
same connection.
The CONNECTION= option enables you to control the number of
connections, and therefore transactions, that your SAS/ACCESS engine
executes and supports for each Pass-Through CONNECT statement.
When CONNECTION=GLOBAL, multiple CONNECT statements that use
identical values for CONNECTION=, CONNECTION_GROUP=,
DBCONINIT=, DBCONTERM=, and any database connection arguments can
share the same connection to the DBMS.