DatabaseOnly: String;
The DatabaseOnly property determines identifier of the PostgreSQL server database, in which the repository is created.
The public schema is used by default. If on DBMS back end preparation a custom schema as created that is used as a default schema, enter it via a point after the database identifier using the IPrimaryPostgresSPLD.Database property or the IPrimaryPostgresSPLD.SchemaOnly property.
Executing the example requires that the PostgreSQL DBMS server contains the DB_REPOSITORY database. DNS-name of server - Server, custom schema - SCHEMA_NAME. Make sure that a repository is created based on the specified database.
Add a link to the Metabase system assembly.
Sub UserProc;
Var
MbMan: IMetabaseManager;
MbDefs: IMetabaseDefinitions;
MbDef: IMetabaseDefinition;
PostgreSPLD: IPrimaryPostgresSPLD;
Begin
// Get repository manager parameters
MbMan := MetabaseManagerFactory.Active;
MbDefs := MbMan.Definitions;
// Add a new repository connection
MbDef := MbDefs.Add;
MbDef.DriverId := "POSTGRES";
MbDef.Id := "Test3_PostgreSQL";
MbDef.Name := "Test_PostgreSQL";
MbDef.Authentication := AuthenticationMode.Password;
MbDef.SecurityPackage := "STANDARDSECURITYPACKAGE";
PostgreSPLD := MbDef.LogonData As IPrimaryPostgresSPLD;
// Set PostgreSQL DBMS server name
PostgreSPLD.Server := "Server";
// Set identifier of the database, in which repository is created
PostgreSPLD.DatabaseOnly := "DB_REPOSITORY";
// Set custom schema identifier
PostgreSPLD.SchemaOnly := "SCHEMA_NAME";
// Save changes
MbDef.Save;
// Display used database and custom schema in the console
Debug.WriteLine("Database and custom schema: " + PostgreSPLD.Database);
End Sub UserProc;
After executing the example a new repository connection is created. The console displays the used database and custom schema via a point:
Database and custom schema: DB_REPOSITORY.SCHEMA_NAME
See also: