LogonData: ISecurityPackageLogonData;
The LogonData property returns additional parameters of the security module, containing settings, that are used at connection to databases server.
Executing the example requires a PostgreSQL DBMS based server.
Add links to the Db and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
DB: IDatabase;
LogonData: IPrimaryPostgresSPLD;
Begin
MB := MetabaseClass.Active;
// Information for creating a new object
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_DATABASE;
CrInfo.Id := "NewBD";
CrInfo.Name := "New database";
CrInfo.Parent := MB.Root;
MObj := MB.CreateObject(CrInfo).Edit;
// Set up database
DB := MObj As IDatabase;
DB.Authentication := AuthenticationMode.Password;
DB.DriverId := "POSTGRES";
LogonData := DB.LogonData As IPrimaryPostgresSPLD;
LogonData.Server := "Test";
LogonData.Database := "TestDB";
LogonData.SSLMode := PostgresSSLMode.VerifyCA;
// Save changes
MObj.Save;
End Sub UserProc;
After executing the example, a new database is created in repository root. The data is placed on the Test server in the TestDB schema. During the connection, an SSL connection is created with checking server root certificate.
See also: