Connecting to a Remote SAS OLAP Server

Goal

You want your application to connect to a remote SAS OLAP Server. (Although it is technically possible to make a local connection to a SAS OLAP Server, typically the connection is remote.)
This recipe applies to the OLAP provider. This recipe applies only to ADO. Sample code is included.
Note: The connection strings use the Data Source URI format. For more information, see What Is the Data Source URI Format?.
For an explanation of the properties used in the sample code, see OLAP Provider Properties .

Implementation

Sample Connection Code for Common SAS 9.2 Server Configurations

The following table provides examples of connection strings that you use to access common SAS 9.2 server configurations. In these examples, the SAS OLAP Server name is olap.example.com and the port number is 8591.
Note: If you are not connecting to SAS 9.2 servers, then you cannot use the sample code in this topic.
Sample Code for Common SAS 9.2 Server Configurations with SAS 9.2
Server Configuration
Sample Code
Bridge with host authentication
Dim connectionString As String

connectionString = "Provider=sas.OLAPProvider.9.2; _
Data Source=iom-bridge://olap.example.com:8591; _
User ID=jdoe;Password=djru7"
Bridge with IWA1
Dim connectionString As String

connectionString = "Provider=sas.OLAPProvider.9.2; _
Data Source=""iom://olap.example.com:8591; _
Bridge;SECURITYPACKAGE=Negotiate"""
1Extra quotation marks are required because of the semicolon used in the "Data Source" property value. If you are not using a connection string, then you do not need the extra quotation marks.

Sample Connection Code for SAS 9.2 Server Configurations That Include a SAS Metadata Server

The following table provides examples of connection strings for accessing common SAS 9.2 server configurations that include a SAS 9.2 Metadata Server. In these examples, the host name is metadata.example.com and the port number is 8561.
Note: If you are not connecting to SAS 9.2 servers, then you cannot use the sample code in this topic.
Sample Code for Common SAS 9.2 Server Configurations That Include a SAS Metadata Server
Server Configuration
Sample Code
Bridge with a logical server name defined in a SAS Metadata Server and host authentication
Dim connectionString As String

connectionString = "Provider=sas.OLAPProvider; _
Data Source=iom-name://OLAP Server - Logical Server Name; _
SAS Metadata Location=iom-bridge://metadata.example.com:8561; _
SAS Metadata User ID=jdoe;SAS Metadata Password=djru7"
Bridge with a logical server name defined in a SAS Metadata Server and IWA2
Dim connectionString As String

connectionString = "Provider=SAS.OLAPProvider.9.2; _
Data Source=iom-name://OLAP Server - Logical Server Name; _
SAS Metadata Location=""iom://metadata.example.com:8561; _
Bridge;SECURITYPACKAGE=Negotiate"""
If the user is not defined in the same authentication domain as the logical server name, then you must also include a line of code that specifies the user ID and password for the remote server.
User ID=jdoe;Password=djru7;
Logical server name defined in a SAS Metadata Server that is configured via the SAS Integration Technologies configuration utility2
Dim connectionString As String

connectionString = "Provider=SAS.OLAPProvider.9.2; _
Data Source=iom-name://OLAP Server - Logical Server Name"
1Extra quotation marks are required because of the semicolon used in the "Data Source" property value. If you are not using a connection string, then you do not need the extra quotation marks.
2The SAS Integration Technologies configuration utility (ITConfig) enables you to create a configuration file that contains information about how to access the metadata server. The provider uses that metadata server in order to resolve logical server names. This type of connection does not require any additional metadata server information.

Sample Connection Code That Uses a Connection String

The following Visual Basic code works with all versions of SAS. In these examples, the SAS OLAP Server name is olap.example.com and the port number is 8591.
Dim obConnection As New ADODB.Connection 
Dim connectionString As String

connectionString = "Provider=SAS.OLAPProvider.9.2;Data Source=olap.example.com; _
SAS Port=8591;SAS Protocol= SASObjectManager.ProtocolBridge;User ID=myuserid; _
Password=mypassword"
obConnection.Open connectionString 
Note: To use the sample code, you must reference the SASObjectManager Type Library in your Visual Basic project. SASObjectManager Type Library is installed with SAS Integration Technologies.