Chapter Contents


SAS ODBC Driver User's Guide and Programmer's Reference

Prerequisites for Communications

The SAS ODBC driver interacts with other software to provide you with access to your data sources. Certain prerequisites apply, depending on whether you want to access local data or remote data. These prerequisites are described in the following sections.

Accessing Local SAS Data Sources

To access local SAS data sources, the SAS ODBC driver uses a SAS ODBC server in conjunction with TCP/IP. You must edit your TCP/IP Services file to define your servers before starting the SAS ODBC Server. It is not necessary for the server to be running when you define your data sources. However, the server must be running on your PC in order for you to access your SAS data sources. For information about editing the TCP/IP Services file, see The TCP/IP Services File. For more information about SAS servers, see SAS Servers.

Starting a SAS ODBC Server

If there isn't already a SAS ODBC server running on your PC, the SAS ODBC driver uses the information that you supplied in the Local Options dialog (described in Local Options Dialog) to automatically start one for you. That is, you do not need to take any action to start the server.

If you already have a SAS session running on your PC, then you can start the SAS ODBC server in that session by submitting the following statements:

options com
proc odbcserv id=server-name authenticate=optional;

The server-name must be the same as the name you specified in the Servers page when you defined your local data source, as explained in Defining Servers.

Alternatively, you can terminate your SAS session so that the SAS ODBC driver can start a SAS ODBC server for you in a new SAS session.(footnote 1)

Note:   When the server is running in the SAS session, the SAS session does not accept user input from the keyboard.  [cautionend]

If the SAS session cannot be started before the SAS Timeout value that you specified in the Local Options dialog is reached, a timeout error is returned to your ODBC client application. An error message is also returned to the client if the SAS session was started but PROC ODBCSERV could not execute.

Terminating the SAS ODBC Server

When you are finished using your ODBC client application to access your local SAS data sources, the SAS ODBC server continues to execute in case you want to access additional SAS data sources. To terminate the server, do either of the following:

Accessing Remote (SAS/SHARE) Data Sources

To access remote data sources, the SAS ODBC driver uses a SAS/SHARE server. (See SAS Servers for more information. See SAS/SHARE User's Guide for complete information about SAS/SHARE .) It is not necessary for the server to be running when you define your data sources. However, the server must be running on your remote host in order for you to access your data sources.

Because a SAS/SHARE server is used by multiple users, it is usually invoked on the remote host at system startup time. Therefore, end users generally do not need to take any local action to invoke the server.

Whoever is responsible for starting the SAS/SHARE server (you or your server administrator) must do the following:

  1. Define the server(s) in the TCP/IP Services file for the client machine(s) that are running the server(s). (footnote 2) (For more information, see The TCP/IP Services File.)

  2. Specify COMAMID=TCP in an OPTIONS statement when you invoke PROC SERVER, as in the following example:
    options comamid=tcp;
    proc server id=server-name authenticate=optional;

The TCP/IP Services File

The TCP/IP Services file contains information about the names of the available services on the machine, along with the port number, protocol name, and any aliases corresponding to each service. For the purposes of the SAS ODBC driver, each entry in this file associates a SAS Server (service name) with the port number and protocol used by that service. The location of the Services file varies on different platforms. In order to configure the SAS ODBC driver appropriately, you must locate the Services file for your platform. Common locations for the Services file are:
Unix /etc/services

Entries in the services file take the following general form:

<official service name> <port number/protocol name> <aliases> # 

Editing the TCP/IP Services File

To configure your Services file for use with the SAS ODBC driver, you must add an entry to the services file for each SAS server (either local or remote) that you have configured using the ODBC Administrator.

The port number that you use should be an unused port number in this file (for larger networks, contact your network administrator to obtain an available port number). The port number must be above 1024, as any port number equal to or less than 1024 is reserved. The protocol must always be tcp. The server name must be one to eight characters long, and it is generally case-sensitive. The first character must be a letter or an underscore; the remaining seven characters can include letters, digits, underscores, the dollar ($) sign, or the at (@) sign. You specify the same server name in the Servers page when you define your data source as explained in Defining Servers.

For example, if, in the ODBC Administrator, you have configured a local ODBC server named shr1 and a remote SAS/SHARE server named machine.shr2 you would add entries to the Services file similar to the following (substituting the appropriate port numbers):

shr1    5010/tcp    #Local ODBC Server
shr2    5011/tcp    #Remote SAS/SHARE Server

Note:   In the case of shr2, the administrator of the remote system named machine should have already edited the Services file on that system to include the same shr2 entry and should have started the SAS/SHARE server.  [cautionend]

FOOTNOTE 1:  Under Windows NT, it is not necessary to terminate the SAS session because you can run multiple SAS sessions in that environment. [arrow]

FOOTNOTE 2:  Refer to the documentation for your TCP/IP software to find the path name for the Services file. [arrow]

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.