SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Accessing Other Vendors' DBMS Data
DBMS Access Using the SQL Procedure Pass-Through Facility


The CONNECT Statement

To establish a connection with the DBMS, use the CONNECT statement. The connection stays in effect until you submit a DISCONNECT statement or terminate the SQL procedure.


General form, CONNECT statement:
CONNECT TO dbms-name <AS alias>                      <(<connect-statement-arguments>                      <database-connection-arguments>)>;

where

  • dbms-name identifies the database management system.

  • alias names an optional alias for the connection that has 1 to 8 characters.

  • 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 are optional.

  • 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.

Note: If you specify arguments, you must enclose them in parentheses.


Example

The CONNECT statement below connects to a SYBASE server and assigns it the alias Sybcon1. SYBASE is a case sensitive database, so the database objects are in uppercase, as they were created. The CONNECTION=GLOBAL argument specifies that multiple CONNECT statements that use identical values for all options can share the same connection to the DBMS. Notice that arguments are enclosed in parentheses.

     proc sql;
        connect to sybase as sybcon1
           (server=SERVER1 database=PERSONNEL
              user=testuser password=testpass
              connection=global);
        ...
     quit;

back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement