Contents Developing Windows Clients  

DataService Object

Provides access to data sources.

DataService Full Description

Attributes

Parent Property

Methods

ListLibrefs Method
AssignLibref Method
DeassignLibref Method
UseLibref Method

Exceptions

DataServiceNoLibrary Error
DataServiceNoWorkDeassign Error
DataServiceLibraryInUse Error
DataServiceInvalidEngine Error

Description

This service provides access to tabular data sources within a SAS Workspace. It acts as an access point within the workspace for standard data access APIs such as ADO, OLE DB and JDBC. It also gives you control over data source configuration by providing methods to manage the workspace's librefs. Librefs are references to SAS data libraries. They are often used by SAS language programs to specify SAS datasets.



Readonly Property Parent

Parent Workspace property

Type: Workspace

Description

This property allows you to navigate back to the Workspace, which is the parent of this object.

Example

Usage


Method ListLibrefs

Lists all the currently defined libraries.

Description

This method returns a list of the names of all the currently defined libraries in the server.

Usage

You can use this method to discover what libraries are assigned in your Workspace. The return value is an array of strings listing the libref names. If you need a Libref object, you can pass any of the returned names to UseLibref.

Parameters

Name Direction Type Description
names  out  String(index)  An array of strings containing the libref names.  

Errors Returned

NoAccessMethod

LNameNoAssign

Example

See Also


Method AssignLibref

Assigns a libref for the specified path, and returns a pointer to a new object for the libref.

Description

This method uses the specified information to assign a libref in the server. It then returns a Libref object which represents the new libref. This method is equivalent to the LIBNAME statement in the SAS language. You can use the Libref object to access and manipulate the members of the library.

This method is similar to the UseLibref method in that they both return a Libref object. However, it differs in that it creates a new libref while the UseLibref method references an existing libref.

Usage

The name, engine, path, and options parameters adhere to the conventions of the corresponding parts of the LIBNAME statement.

Parameters

Name Direction Type Description
name  in  String  This parameter is the name of the libref, which acts as a logical name for the data library to which it is assigned. It should conform to the rules of SAS libref names for the platform on which the server is running.  
engine  in  String  This string specifies the name of the engine to use with the newly-created libref. The available engines are dependent on the host system, the version of SAS and the site installation. An empty (zero-length) string indicates the default engine.  
path  in  String  The host filesystem pathname (or other engine-specific designation) of the SAS data library being referenced. The form of the specification is dependent upon the platform on which the server is running and the conventions of the selected engine. The engine will often require that this location (such as a directory) already exist on the server machine.  
options  in  String  This input string contains any LIBNAME and/or engine options that are to be applied to this assignment. If no options are needed, pass an empty (zero-length) string.  

Returns Libref

This method returns a new Libref object that represents the newly created libref. This object remains valid until the library is deassigned or the Workspace is closed.

Errors Returned

InvalidPName

NoAccessMethod

InvalidLName

LNameNoAssign

DataServiceNoLibrary

DataServiceInvalidEngine

Example

See Also


Method DeassignLibref

Deassigns an existing libref.

Description

This method deassigns an existing libref. Calling it is equivalent to executing a LIBNAME CLEAR statement in the SAS language.

If files are currently open in the same scope as the assigned libref, RIO will close the files before deassigning the libref. If there are files currently open in a different scope, the deassign will fail.

Usage

Parameters

Name Direction Type Description
name  in  String  This string parameter specifies the name of the libref to deassign.  

Errors Returned

LNameNoAssign

DataServiceNoWorkDeassign

DataServiceLibraryInUse

Example

See Also


Method UseLibref

Obtains the libref object for the specified libref name.

Description

This method returns a pointer to a Libref object for an existing library. The Libref object is used to access and manipulate the members of the library.

Usage

This method is similar to the AssignLibref method in that they both return a Libref object. However, it differs in that it returns the object for an existing library whereas AssignLibref creates a new libref and returns the object for that.

Parameters

Name Direction Type Description
name  in  String  This string specifies the name of the existing libref that is to be used. The name must correspond to a libref that has already been assigned in this Workspace. This libref could have been created by the AssignLibref method call, it could have resulted from the execution of a LIBNAME statement or it may be a predefined library such as WORK, SASUSER or SASHELP.  

Returns Libref

This method returns the Libref object which represents the libref with the specified name.

Errors Returned

LNameNoAssign

DataServiceNoLibrary

Example

See Also


Enum DataServiceERRORS

DataServiceNoLibrary
A specified SAS data library does not exist.

Description
The specified SAS data library does not exist.

DataServiceNoWorkDeassign
The SAS System library WORK may not be deassigned.

Description
The SAS System library WORK may not be deassigned.

DataServiceLibraryInUse
The data service could not clear or deassign a library because it was in use.

Description
The data service could not clear or deassign a library because it was in use.

DataServiceInvalidEngine
The specified SAS engine was not found.

Description
The specified SAS engine was not found. The engine name that you specified is probably invalid, but it may also be that the the engine is not available on this host or on this release of the SAS System.

Contents Developing Windows Clients