IDatabase.Credentials

Syntax

Credentials: ICredentials;

Description

The Credentials property returns user credentials used at automatic connection to a database.

Comments

The property is read-only. To create new credentials, use the ISecurityPackage.CreateCredentials method.

Example

Add links to the Db and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    DB: IDatabase;
    Package: ISecurityPackage;
    OracleSPLD: IPrimaryOracleSPLD;
    PswCreds: IPasswordCredentials;
Begin
    MB := MetabaseClass.Active;
    // Create a database
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_DATABASE;
    CrInfo.Id := "NewDB";
    CrInfo.Name := "New database";
    CrInfo.Parent := MB.Root;
    DB := MB.CreateObject(CrInfo).Edit As IDatabase;
    // Determine DBMS connection settings
    DB.Authentication := AuthenticationMode.Password;
    DB.DriverId := "ORCL8";
    OracleSPLD := DB.LogonData As IPrimaryOracleSPLD;
    OracleSPLD.Server := "TestServer";
    OracleSPLD.Scheme := "TestRepository";
    DB.LoginPrompt := False;
    // Credentials
    Package := New StandardSecurityPackage.Create;
    PswCreds := Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
    PswCreds.UserName := "User";
    PswCreds.Password := "Password";
    DB.Credentials := PswCreds;
    // Save changes
    (DB As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, a new database is created in repository root. Data is settled on the TestServer server in the TestRepository repository. The repository login will be executed automatically with the credentials specified in the example.

See also:

IDatabase