IRepositoryScriptManager.Connection

Syntax

Connection: Object;

Connection: Object;

Description

The Connection property determines connection with database server within which all operations take place.

Comments

It is necessary to set a connection implemented by the ISecurityConnection or IDalConnection interface as a value.

Example #1

Executing the example requires the Oracle server named Test. The "TestSchema" scheme is created on the server. The root of disk C contains the current.rm4 file that includes the script for repository creating.

Add links to the Dal, Fore, IO system assemblies.

Sub UserProc;
Var
    Rsm: IRepositoryScriptManager;
    Driv: IDalDriver;
    ConDesc: IDalConnectionDescriptor;
    Params: IDalConnectionDescriptorParams;
    Con: IDalConnection;
Begin
    
//Connection to schema on the Oracle server
    Driv := New DalOrcl8Driver.Create As IDalDriver;
    ConDesc := Driv.CreateDescriptor;
    Params := ConDesc.Params;
    Params.Find(
"User Name").Value := "TestSchema";
    Params.Find(
"Password").Value := "TestSchema";
    Params.Find(
"Host BSTR").Value := "Test";
    Params.Find(
"Schema").Value := "TestSchema";
    Con := ConDesc.CreateConnection;
    
//Repository manager settings
    Rsm := New RepositoryScriptManager.Create;
    Rsm.Connection := Con;
    Rsm.Driver := RepositoryDriverType.ORCL9;
    Rsm.Operation := RepositoryOperationType.Create;
    Rsm.Repository := RepositoryType.Metabase;
    Rsm.LoadScript(
New FileStream.Create("c:\Current.rm4", FileOpenMode.Read, FileShare.Exclusive));
    Rsm.Execute(
Null);
End Sub UserProc;

Imports System.IO;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.KeFore;

Public Shared Sub Main(Params: StartParams);
Var
    Rsm: IRepositoryScriptManager = 
New RepositoryScriptManagerClass();
    Driv: IDalDriver = 
New DalOrcl8DriverClass();
    ConDesc: IDalConnectionDescriptor;
    DalParams: IDalConnectionDescriptorParams;
    Con: IDalConnection;
Begin
    
//Connection to schema on the Oracle server
    ConDesc := Driv.CreateDescriptor();
    DalParams := ConDesc.Params;
    DalParams.Find(
"User Name").Value := "TestSchema";
    DalParams.Find(
"Password").Value := "TestSchema";
    DalParams.Find(
"Host BSTR").Value := "Test";
    DalParams.Find(
"Schema").Value := "TestSchema";
    Con := ConDesc.CreateConnection();
    
//Repository manager settings
    Rsm.Connection := Con;
    Rsm.Driver := RepositoryDriverType.repwelknodritypORCL9;
    Rsm.Operation := RepositoryOperationType.repopetypCreate;
    Rsm.Repository := RepositoryType.reptypMetabase;
    Rsm.LoadScript(
New FileStream("c:\current.rm4", FileMode.Open, FileAccess.Read));
    Rsm.Execute(
Null);
End Sub;

After executing the example, a new platform repository will be created on the Test server in the TestSchema scheme.

Example #2

Executing the example requires Microsoft SQL Server server named Test. There is the "TestSchema" database on the server. The root of disk C contains the current.rm4 file that includes the script for repository creating.

Add links to the Dal, Fore, IO system assemblies.

Sub UserProc;
Var
    Rsm: IRepositoryScriptManager;
    Driv: IDalDriver;
    ConDesc: IDalConnectionDescriptor;
    Params: IDalConnectionDescriptorParams;
    Con: IDalConnection;
Begin
    
//Connect to schema on Microsoft SQL Server server
    Driv := New DalMsSql2012Driver.Create As IDalDriver;
    ConDesc := Driv.CreateDescriptor;
    Params := ConDesc.Params;
    Params.Find(
"User Name").Value := "TestSchema";
    Params.Find(
"Password").Value := "TestSchema";
    Params.Find(
"Host BSTR").Value := "Test";
    Params.Find(
"Database").Value := "TestSchema";
    Con := ConDesc.CreateConnection;
    
//Repository manager settings
    Rsm := New RepositoryScriptManager.Create;
    Rsm.Connection := Con;
    Rsm.Driver := RepositoryDriverType.MSSQL2008;
    Rsm.Operation := RepositoryOperationType.Create;
    Rsm.Repository := RepositoryType.Metabase;
    Rsm.Unicode := 
True;
    Rsm.LoadScript(
New FileStream.Create("c:\current.rm4", FileOpenMode.Read, FileShare.Exclusive));
    Rsm.Execute(
Null);
End Sub UserProc;

Imports System.IO;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.KeFore;

Public Shared Sub Main(Params: StartParams);
Var
    Rsm: IRepositoryScriptManager = 
New RepositoryScriptManagerClass();
    Driv: IDalDriver = 
New DalMsSql2012DriverClass();
    ConDesc: IDalConnectionDescriptor;
    DalParams: IDalConnectionDescriptorParams;
    Con: IDalConnection;
Begin
    
//Connect to schema on Microsoft SQL Server server
    ConDesc := Driv.CreateDescriptor();
    DalParams := ConDesc.Params;
    DalParams.Find(
"User Name").Value := "TestSchema";
    DalParams.Find(
"Password").Value := "TestSchema";
    DalParams.Find(
"Host BSTR").Value := "Test";
    DalParams.Find(
"Database").Value := "TestSchema";
    Con := ConDesc.CreateConnection();
    
//Repository manager settings
    Rsm.Connection := Con;
    Rsm.Driver := RepositoryDriverType.repwelknodritypMSSQL2012;
    Rsm.Operation := RepositoryOperationType.repopetypCreate;
    Rsm.Repository := RepositoryType.reptypMetabase;
    Rsm.Unicode := 
True;
    Rsm.LoadScript(
New FileStream("c:\current.rm4", FileMode.Open, FileAccess.Read));
    Rsm.Execute(
Null);
End Sub;

After executing the example a unicode version of the. Analytics Platform task scheduler.

See also:

IRepositoryScriptManager