IPrimaryClickHouseSPLD.Database

Syntax

Database: String;

Description

The Database property determines database identifier on the ClickHouse server.

Example

Add links to the Database and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    DB: IDatabase;
    LogonData: IPrimaryClickHouseSPLD;
    Package: ISecurityPackage;
    PasswordCreds: IPasswordCredentials;
Begin
    MB := MetabaseClass.Active;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_DATABASE;
    CrInfo.Id := MB.GenerateId("ClickHouse");
    CrInfo.Name := "Connect to ClickHouse";
    CrInfo.Parent := MB.Root;
    MObj := MB.CreateObject(CrInfo).Edit;
    DB := MObj As IDatabase;
    DB.Authentication := AuthenticationMode.Password;
    DB.DriverId := "CLICKHOUSE";
    LogonData := DB.LogonData As IPrimaryClickHouseSPLD;
    LogonData.Server := "CHServer";
    LogonData.Database := "default";
    DB.LoginPrompt := False;
    Package := New StandardSecurityPackage.Create;
    PasswordCreds := Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
    PasswordCreds.UserName := "default";
    PasswordCreds.Password := "password";
    DB.Credentials := PasswordCreds;
    MObj.Save;
End Sub UserProc;

After executing the example, a new database is created in the repository root folder, which connects to a CickHouse DBMS based server.

See also:

IPrimaryClickHouseSPLD