SAS IT technology uses ADO Connection Object

zhaozj2021-02-16  109

Excerpt from SAS website

Opening an ado connection Object

.

Applies TO: All Sas Data Providers Implement Using: ADO

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

Identifying the provider

To specify the provider in your application, you enter its ProgID, which is a unique name that identifies a COM component. All providers support both version-dependent and version-independent ProgIDs, which enables you to install different versions of the providers on the same System and to write applications That use sales.

TO CREATE AN Application That ... Use this form ... Examplesalways Uses The Latest Version of The Provider That ISTALLED ON A Machine "Sas.Provider" "Sas.localProvider" "Sas.ShareProvider" "SAS.IOMPROVIDER" SAS .Olapprovider "Only Uses a Specific Version of A Provider" Sas.Provider.major Version.minor Version "" SAS.LOCALPROVIDER.9.0 "

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 There Two Ways:

"SAS.IOMPROVIDER" "SAS.IOMPROVIDER.1" The Sas 9.1 IOM Data Provider Can Be Specification 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 Province Connection Properties

SAS IOM Provider Connection Properties

The Sas Iom Data Provider Supports The Following Properties on The ADO Connection Object:

PropertyValueRequired? Data SourceUse 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. YesUser IDUser ID that is used to authenticate against the server.NoPasswordPassword to use with the user ID in authenticating against the server.NoSAS Workspace IDA unique ID generated by the SAS Workspace Manager.NoSAS Logical NameAn entry name in your LDAP (Lightweight Directory Access Protocol) repository that defines an IOM server. NoSAS PortPort number of remote server.NoSAS Service NameA logical reference to the port associated with a remote server.NoSAS Machine DNS NameNetwork DNS name of the remote server.NoSAS ProtocolIOM protocol to use when connecting to the remote server.NoSAS Server TypeTabular data server or OLAP Server. 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: Obconnection.Provider = "SAS.IOMPROVIDER"

Obconnection.properties ("Data Source") = "_local_"

Obconnection.open

See Also: Connecting to a Iom Remote ServerConnecting to a Remote Sas Olap Server with the Iom providerreusing an existing Iom Workspace.

SAS OLAP Provider Connection Properties

The Sas Olap Data Provider Supports The Following Properties on The ADO Connection Object:

PropertyValueRequired? Data SourceThe name of the OLAP server to which you are connecting. YesUser IDUser ID that is used to authenticate against the server.NoPasswordPassword to use with the user ID in authenticating against the server.NoSAS PortPort number of remote server.NoSAS Service NameA Logical Reference to the port associated with a remote server.nosas protocoliom protocol to use when connecting to the remote server.no

See Also: Connecting to A Remote Sas Olap Server

Local Provider Connection Properties

The Local Provider Supports The Following Properties on The ADO Connection Object:

? PropertyValueRequired Data SourceA physical directory that contains the SAS data set that you want to access with the connection.YesModeadModeRead or adModeReadWriteNoSAS File FormatThe SAS file format access method to associate with the connection Valid values:. "V6", "V7", "V8 ", And" v9 ".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, THE FOLLOWING VISUAL Basic Code Will Open THE Connection That You NEED: Obconnection.Provider = "SAS.LOCALPROVIDER"

Obconnection.properties ("Data Source") = "C: / My Documents / SAS Files"

Obconnection.open

See Also: Specifying A File Format

SAS / Share Provider Connection Properties

The Sas / Share Provider Supports The Following Properties on The ADO Connection Object:

PropertyValueRequired? Data SourceThe server ID (established by the server administrator when the SAS / SHARE server is started) .YesModeadModeRead or adModeReadWriteNoLocationThe node that the server is running on. Only if the node is not the one running the ADO application.User IDThe user ID that is used to access a remote server.NoPasswordThe password that is used to access a remote server.NoSAS Server Access PasswordThe server access password (if one was established by the server administrator when the SAS / SHARE server was started) .NoSAS Server ReleaseThe server Access method to associate with the connection. Valid Values: "7", "8", And "9" 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."

Obconnection.Provider = "Sas.ShareProvider"

Obconnection.properties ("Data Source") = Server_idobConnection.Open

See Also: Connecting to A Remote Sas / Share ServerStarting a Single-User Local Server with the Sas / Share ProviderConnecting to a Specific Sas / Share Server Version

Three Ways to Open the Connection Object

Here Is a Quick Overview of Three Ways To Open An Ado Connection Object:

Method 1: Use a connection string

Set The Connection Object's Properties in a one-line string. The Following Sample Code Shows The Format.

Obconnection.open "provider = provider_name; data source = data_source; other_provider_specific_info"

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.

Obconnection.connectionstring = "provider = provider_name; data source = data_source; other_provider_specific_info"

Obconnection.open

Method 3: Use the connection Object's Province Property

Set The Connection Object's Provider Property, and The 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

转载请注明原文地址:https://www.9cbs.com/read-10274.html

New Post(0)