After you purchase a Hologres instance, the system automatically creates a database named postgres and allocates limited resources to this database for management only. You must create a database for your business purpose. This topic describes how to create a database in the Hologres console or in HoloStudio.

Procedure

  1. Create a database.
    Create a database by using SQL statements.

    Go to HoloStudio and execute the following SQL statement to create a database:

    CREATE DATABASE <dbname>;
    CREATE DATABASE testdb; // Create a database named testdb.
  2. Bind the new database to a workspace.
    To use the new database in HoloStudio, you must bind the database to a DataWorks workspace. The method is as follows:

    Go to the DataWorks workspace and click Workspace Management page in the upper-right corner. On the Workspace Management page that appears, click the Hologres tab in the Compute Engine section and click Binding HologresDB. The Binding HologresDB dialog box appears.

    845
  3. Configure the database information.
    Configure the database information and click Test connectivity. If the message Test succeeded appears, the database is bound to the workspace. Click OK.
    Note To guarantee data security, the production environment and development environment are isolated from each other in a workspace in the standard mode. Currently, HoloStudio cannot switch between the two environments. As a result, HoloStudio cannot obtain data from the production environment. To resolve this issue, we recommend that you bind the same database to the development and production environments.
    847
    Section Parameter Description Remarks
    Instance display name field Instance display name The display name of the Hologres instance you purchased, which can be customized. None
    Production Environment section Access identity The identity for running nodes committed to the production environment. Select Alibaba Cloud account or RAM user. This parameter specifies the identity for executing the code of committed nodes in Hologres.
    Hologres instance name The name of the Hologres instance you purchased. Select the name from the drop-down list. None
    Database name The name of the database to be bound to the production environment. We recommend that you bind the same database to the development and production environments.
    Server The endpoint of the Hologres instance. The endpoint is automatically generated for the selected instance.
    Port The port number of the Hologres instance. The port number is automatically generated for the selected instance.
    Test connectivity Click Test connectivity to test the connectivity between the production environment and the Hologres instance. None
    Development Environment section Access identity The identity for running nodes committed to the development environment. Select Task executor. None
    Hologres instance name The name of the Hologres instance you purchased. Select the name from the drop-down list. None
    Database name The name of the database to be bound to the development environment. After you purchase a Hologres instance, the system automatically creates a database named postgres for management only. You must create a database for your business purpose in the Hologres console and bind the database to the environment.
    Server The endpoint of the Hologres instance. The endpoint is automatically generated for the selected instance.
    Port The port number of the Hologres instance. The port number is automatically generated for the selected instance.
    Test connectivity Click Test connectivity to test the connectivity between the development environment and the Hologres instance. None
  4. Use the new database for data analytics.
    After you bind the new database to a workspace, go to HoloStudio, click PG management in the left-side navigation pane, and then click Refresh. The new database appears. You can select the new database for data analytics.

What to do next

You can bind a database to a DataWorks workspace as a RAM user that meets the following conditions:

  • The RAM user has the permission to connect to the database.
  • The RAM user is the administrator of the DataWorks workspace.

When you attempt to bind a database to a workspace as a RAM user that does not meet the preceding conditions, the Binding HologresDB button is unavailable.