IDalConnectionDescriptor2.ConnectAsPrivilege

Syntax

ConnectAsPrivilege: DalConnectAsPrivilegeType;

Description

The ConnectAsPrivilege property determines a database server connection with the specified privilege.

NOTE. The property is not intended to be used in application code. It is kept to be compatible with previous versions.

Comments

Connection with the privilege can be set only for Oracle servers Oracle 9.x\10.x\11.x.

Connection with the privileges may be required only for executing Foresight Analytics Platform operations that require assigning the parameters of the account that has the administration permissions in the Oracle. For example, when the SYSTEM user was locked by the safety requirements, and there is only one SYS user.

Example

To execute the example, connect the Metabase and Dal system assemblies to the module. It is supposed that the repository is located at the Oracle server (Oracle DBMS 9.x\10.x\11.x), the server contains the SYS user with the Password password, and the repository contains a table with the Table identifier.

Sub UserProc;
Var
    MB: IMetabase;
    Driv: IDalDriver;
    Connect: IDalConnection;
    Connect2: IDalConnectionDescriptor2;
    Command: IDalCommand;
    ConnectDesc: IDalConnectionDescriptor;
    ConnectDescParams: IDalConnectionDescriptorParams;
Begin
    MB := MetabaseClass.Active;
    Driv := New DalOrcl8Driver.Create;
    ConnectDesc := Driv.CreateDescriptor;
    ConnectDescParams := ConnectDesc.Params;
    ConnectDescParams.Find("User Name").Value := "SYS";
    ConnectDescParams.Find("Password").Value := "Password";
    ConnectDescParams.Find("Host BSTR").Value := "test";
    ConnectDescParams.Find("Schema").Value := "Warehouse";
    //User with the SYS privilege
    Connect2 := ConnectDesc As IDalConnectionDescriptor2;
    Connect2.ConnectAsPrivilege := DalConnectAsPrivilegeType.SYSOPER;
    Connect := ConnectDesc.CreateConnection;
    Command := Connect.CreateCommand;
    Command.SQL := "select * from Table";
    Connect.StartTransaction;
    Command.Execute;
    Connect.Commit;
    Command.Close;
    Connect.Close;
End Sub UserProc;

After executing the example the SQL query is executed, the user account credentials with the SYSOPER privilege are specified for connection.

See also:

IDalConnectionDescriptor2