PostgreSQL

This section describes how to start up an instance of a PostgreSQL Server database.

Creating a PostgreSQL Server instance.

Create a new instance of Bard.Db.PostgresDatabasepassing in the database name, username , password and port number.

var db = new PostgresDatabase(
    databaseName: "PostgreSQL_latest",
    postgresUser: "Db_user",
    password: "Password1",
    portNumber: "5432",
    tagName: "latest");

Port number, and tagName are optional. If they are not supplied then the default value is

latest & 5432

Starting up the Database

To start the database instance simply call either. The result is the IP address of the host machine in case this is needed in the connection string.

var result = db.StartDatabase();

This may take a little time the first time as Docker needs to download the image in the background.

Stopping the Database

To stop the database simply call.

 db.StopDatabase();

Last updated