13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The SQL Pass-Through Facility <strong>for</strong> <strong>Relational</strong> <strong>Databases</strong> 4 CONNECT Statement 427CONNECT StatementEstablishes a connection with the DBMSValid in:PROC SQL steps (when accessing DBMS data using <strong>SAS</strong>/<strong>ACCESS</strong> software)SyntaxCONNECT TO dbms-name ;The CONNECT statement establishes a connection with the DBMS. You establish aconnection to send DBMS-specific SQL statements to the DBMS or to retrieve DBMSdata. The connection remains in effect until you issue a DISCONNECT statement orterminate the SQL procedure.Follow these steps to connect to a DBMS using the SQL pass-through facility.1 Initiate a PROC SQL step.2 Use the SQL pass-through facility CONNECT statement, identify the DBMS (suchas Oracle or DB2), and assign an (optional) alias.3 Specify any attributes <strong>for</strong> the connection such as SHARED or UNIQUE.4 Specify any arguments that are needed to connect to the database.The CONNECT statement is optional <strong>for</strong> some DBMSs. However, if it is notspecified, the default values <strong>for</strong> all database connection arguments are used.Any return code or message that is generated by the DBMS is available in the macrovariables SQLXRC and SQLXMSG after the statement executes. See “Macro Variables<strong>for</strong> <strong>Relational</strong> <strong>Databases</strong>” on page 401 <strong>for</strong> more in<strong>for</strong>mation about these macro variables.ArgumentsUse these arguments with the CONNECT statement.dbms-nameidentifies the database management system to which you want to connect. Youmust specify the DBMS name <strong>for</strong> your <strong>SAS</strong>/<strong>ACCESS</strong> interface. You can alsospecify an optional alias.aliasspecifies <strong>for</strong> the connection an optional alias that has 1 to 32 characters. If youspecify an alias, the keyword AS must appear be<strong>for</strong>e the alias. If an alias is notspecified, the DBMS name is used as the name of the Pass-Through connection.database-connection-argumentsspecifies the DBMS-specific arguments that PROC SQL needs to connect to theDBMS. These arguments are optional <strong>for</strong> most databases. However, if you includethem, you must enclose them in parentheses. See the documentation <strong>for</strong> your<strong>SAS</strong>/<strong>ACCESS</strong> interface <strong>for</strong> in<strong>for</strong>mation about these arguments.connect-statement-argumentsspecifies arguments that indicate whether you can make multiple connections,shared or unique connections, and so on, to the database. These arguments enablethe SQL pass-through facility to use some of the LIBNAME statement’s connection

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!