Professional Documents
Culture Documents
http://support.sas.com/documentation/tools/oledb/dbs001.htm
Overview
To open a Connection object, you must specify which provider to use and the appropriate connection properties. After you have this information, you can use one of these methods to send the information to your selected SAS Data Provider. Method 1: Use a Connection String Method 2: Use the Connection Object's ConnectionString Property Method 3: Use the Connection Object's Provider Property
always uses the latest version of the provider that is installed on a machine
"SAS.provider"
To maintain compatibility with previous releases, the special ProgID "sas.provider.1" is maintained as a synonym for the version-independent ProgID. For example, the last SAS IOM Data Provider that was installed on the system can be identified in either of these two ways: "sas.IOMProvider" "sas.IOMProvider.1" The SAS 9.1 IOM Data Provider can be specifically identified as "sas.IOMProvider.9.1".
Connection Properties
Each provider supports its own unique set of Connection object properties. To review the syntax used by each provider, see the following sections: SAS IOM Provider Connection Properties SAS OLAP Provider Connection Properties SAS Local Provider Connection Properties SAS/SHARE Provider Connection Properties
SAS IOM Provider Connection Properties The SAS IOM Data Provider supports the following properties on the ADO Connection object: Property Value Use the keyword "_LOCAL_" to indicate a local instance of the IOM server. To specify a remote server, enter a user-defined name that will be used to refer to the data source. User ID that is used to authenticate against the server. Password to use with the user ID in authenticating against the server. A unique ID generated by the SAS Workspace Manager. An entry name in your LDAP (Lightweight Directory Access Protocol) repository that defines an IOM server. Port number of remote server. A logical reference to the port associated with a remote server. Network DNS name of the remote server. IOM protocol to use when connecting to the remote server. Tabular data server or OLAP server. Required?
Data Source
Yes
User ID Password SAS Workspace ID SAS Logical Name SAS Port SAS Service Name SAS Machine DNS Name SAS Protocol SAS Server Type
No No No No No No No No No
The simplest connection that you can make with the IOM provider is to a server that is running on your local Windows machine. Such a server is bound exclusively to the Connection object that instantiated it. For this type of connection, you only need to specify a "Data Source" property value of "_LOCAL_" , as shown in the following code:
See also: Connecting to a IOM Remote Server Connecting to a Remote SAS OLAP Server with the IOM Provider Reusing an Existing IOM Workspace.
1 de 3
26/12/2011 18:05
http://support.sas.com/documentation/tools/oledb/dbs001.htm
SAS OLAP Provider Connection Properties The SAS OLAP Data Provider supports the following properties on the ADO Connection object: Property Data Source User ID Password SAS Port SAS Service Name SAS Protocol Value The name of the OLAP server to which you are connecting. User ID that is used to authenticate against the server. Password to use with the user ID in authenticating against the server. Port number of remote server. A logical reference to the port associated with a remote server. IOM protocol to use when connecting to the remote server. Required? Yes No No No No No
Local Provider Connection Properties The local provider supports the following properties on the ADO Connection object: Property Data Source Value A physical directory that contains the SAS data set that you want to access with the connection. adModeRead or adModeReadWrite The SAS file format access method to associate with the connection. Valid values: "V6", "V7", "V8", and "V9". Required? Yes
Mode
No
No
The local provider is usually the simplest to configure with an ADO connection. You only need to specify the physical location of the SAS files that you want to access. For example, if your data sets can be found in c:\my documents\sas files, then the following Visual Basic code will open the connection that you need:
SAS/SHARE Provider Connection Properties The SAS/SHARE provider supports the following properties on the ADO Connection object: Property Data Source Mode Location User ID Password SAS Server Access Password SAS Server Release adModeRead or adModeReadWrite The node that the server is running on. The user ID that is used to access a remote server. The password that is used to access a remote server. The server access password (if one was established by the server administrator when the SAS/SHARE server was started). The server access method to associate with the connection. Valid values: "7", "8", and "9" No Value The server ID (established by the server administrator when the SAS/SHARE server is started). Required? Yes No Only if the node is not the one running the ADO application. No No No
The simplest connection that you can make using the SAS/SHARE provider is to a SAS/SHARE server that is running on your local Windows machine. After the Connection object is opened, it is assigned to this server for the duration of the session. For this type of a connection, you only need to specify the server's ID as the "Data Source."
See also: Connecting to a Remote SAS/SHARE Server Starting a Single-User Local Server with the SAS/SHARE Provider Connecting to a Specific SAS/SHARE Server Version
Method 2: Use the Connection Object's ConnectionString Property Set the Connection object's ConnectionString property, and call the Open method without specifying any parameters. The following sample code illustrates how this is done.
2 de 3
26/12/2011 18:05
http://support.sas.com/documentation/tools/oledb/dbs001.htm
Method 3: Use the Connection Object's Provider Property Set the Connection object's Provider property, and then set individual property values by using the Connection object's Properties collection. The following sample code illustrates how this is done.
obConnection.Provider = "provider_name" obConnection.Properties("Data Source") = "data_source" ' Set additional properties via the Properties collection as needed obConnection.Open
Contact Us | Sitemap | RSS Feeds | www.sas.com | Terms of Use & Legal Information | Privacy Statement Copyright 2011 SAS Institute Inc. All Rights Reserved.
3 de 3
26/12/2011 18:05