java.lang.Object
com.aoindustries.aoserv.examples.postgres.AddPostgresDatabase

public final class AddPostgresDatabase extends Object

Before creating a new PostgreSQL database, please make sure that a User has been added for use as the Database Administrator (DBA).

The possible values for encoding may be found in the postgres_encodings table.

Author:
AO Industries, Inc.
See Also:
  • Method Details

    • addPostgresDatabase

      public static void addPostgresDatabase(SimpleAoservClient aoClient, Database.Name name, Server.Name postgresServer, String server, User.Name datdba, String encoding, boolean enablePostgis) throws IOException, SQLException
      Adds a Database to a Host.
      Parameters:
      aoClient - the SimpleAoservClient to use
      name - the name of the database to add
      postgresServer - the name of the PostgreSQL server
      server - the hostname of the server to add the database to
      datdba - the username of the database administrator User
      encoding - the encoding to use
      enablePostgis - enables PostGIS on the database
      Throws:
      IOException
      SQLException
    • addPostgresDatabase

      public static Database addPostgresDatabase(AoservConnector conn, Database.Name name, Server.Name postgresServer, DomainName server, User.Name datdba, String encoding, boolean enablePostgis) throws IOException, SQLException
      Adds a Database to a Host.
      Parameters:
      conn - the AoservConnector to use
      name - the name of the database to add
      postgresServer - the name of the PostgreSQL server
      server - the hostname of the server to add the database to
      datdba - the username of the database administrator User
      encoding - the encoding to use
      enablePostgis - enables PostGIS on the database
      Returns:
      the new Database
      Throws:
      IOException
      SQLException