Skip to main content

Connect to a Database

To manage data or database objects within your Relyt database using a third-party client tool (other than the Relyt console), you need to connect to the database first.

This section demonstrates how to connect to a Relyt database using psql as an example.

info

Relyt is compatible with the PostgreSQL protocol, allowing you to use any PostgreSQL-compatible tool or software to connect to the Relyt database. For detailed instructions on other connection methods, please refer to the relevant sections in Connect to Relyt.


Prerequisites

  • At least one DW service unit for vectors exists in the environment.

  • At least one database exists in the target DW service unit for vectors.

  • You have obtained the username and password for an account, and the account has CONNECT privilege for the target database.


1. Install psql

This section explains how to install the psql tool on Windows, Linux, and MacOS systems. Please choose the appropriate installation method based on your environment.

note

If psql is already installed in your environment, skip this step.

  1. Download the appropriate version of the installer from the PostgreSQL official website.

  2. Double-click the downloaded installer and follow the instructions to complete the installation.

    info

    Ensure that the psql tool is selected during installation.

  3. After installation, right-click the Computer or My Computer desktop icon and select Properties. Then, choose Advanced system settings > Advanced > Environment Variables.

  4. In the System variables section, find Path and add the PostgreSQL bin directory path (e.g., C:\Program Files\PostgreSQL\13\bin).

  5. Open the Command Prompt (cmd) and enter psql --version. If the version information is displayed, psql is installed.

2. Connect to your Relyt database

Run the following command to connect to the Relyt database:

psql -h <endpoint_domain> -p <endpoint_port> -U <dw_user_name> -d <db_name>

Parameter description:

ParameterDescription
endpoint_domainThe public endpoint of the DW service unit.
endpoint_portThe port number of the DW service unit, default is 5432.
dw_user_nameThe username for logging in to the DW service unit.
db_nameThe name of the Relyt database to connect.

For more detailed parameter description and psql usage instructions, see the relevant topic in the Connect to Relyt topic.