This topic describes how to use the pgAdmin 4 client to connect to a PolarDB-O cluster. In addition to connecting to a PolarDB-O cluster in the Apsara PolarDB console, you can also connect to the cluster by using the pgAdmin 4 client.

More connection methods

In addition to using the pgAdmin 4 client, you can also use Command Line Interface (CLI) to connect to an Apsara PolarDB cluster. Click Download clients and drivers to download the client,

  • For more information about how to use JDBC to connect to Apsara PolarDB, see JDBC.
  • For more information about how to use .NET to connect to Apsara PolarDB, see .NET.
  • For more information about how to use ODBC to connect to Apsara PolarDB, see ODBC.
  • For more information about how to use OCI to connect to Apsara PolarDB, see OCI.

Prerequisites

  • You have created a privileged account or a standard account for an existing database cluster. For more information, see Create database accounts.
  • You have added the IP address of the host that you want to connect to the Apsara PolarDB cluster to the whitelist. For more information, see Configure a whitelist for a cluster.
  • You have installed pgAdmin 4 in a client (such as ECS) that can be used to connect to Apsara PolarDB.

Procedure

  1. Launch the pgAdmin 4 client.
  2. Right-click Servers and choose Create > Server, as shown in the following figure.
    Create a server
  3. On the General tab of the Create - Server dialog box, enter the name of the server, as shown in the following figure.
    pgAdmin 4 - General
  4. Click the Connection tab and specify the information about the cluster that you want to connect to. The following table describes the parameters.
    pgAdmin 4 - Connection
    Table 1. Parameter description
    Parameter Description
    Host name/address

    The endpoint of the PolarDB cluster. To view the endpoint and port information about the PolarDB cluster, perform the following steps:

    1. Log on to the PolarDB console.
    2. In the upper-left corner of the console, select the region where the cluster is deployed.
    3. On the Clusters page, click the ID of the cluster that you want to manage.
    4. In the Endpoints section, view the endpoints of the PolarDB cluster.
    Port The port for the PolarDB O Edition cluster. Default value: 1521.
    Maintenance database The maintenance database. Default value: postgres.
    Username The account of the PolarDB cluster. For more information about how to create an account, see Create database accounts.
    Password The password of the account for the PolarDB cluster.
  5. Click Save.
  6. If the connection information is valid, a page that is similar to the following page appears after you click the database name. This indicates that the database is connected.
    Connection established
  7. Right-click the name of the database that you want to manage and click Query Tool.... On the page that appears, you can add, delete, update, and query data in the database.
    Query editor

What to do next

Oracle compatibility

Troubleshooting

  • The IP address whitelist is invalid.
    • The default whitelist contains only the IP address 127.0.0.1. 127.0.0.1 indicates that no IP address is allowed to access the PolarDB cluster. Therefore, you must add the IP addresses of the clients that you use to access your cluster to the whitelist. For more information, see Configure a whitelist for a cluster.
    • The entry in the whitelist is set to 0.0.0.0. The valid format is 0.0.0.0/0.
      Notice 0.0.0.0/0 indicates that all IP addresses are allowed to access the PolarDB cluster. Proceed with caution.
    • The public IP addresses that you add to the whitelist are invalid. For example, the public IP addresses may be dynamic IP addresses, or the tools or websites used to check the public IP addresses provide invalid IP addresses.
  • The internal or public endpoint is incorrectly used.

    If you use an internal endpoint to establish a connection over the Internet or use a public endpoint to establish a connection over an internal network, the connection fails.

    Use the required endpoint. If you want to connect to the PolarDB cluster over an internal network, use an internal endpoint of the PolarDB cluster. If you want to connect to the PolarDB cluster over the Internet, use a public endpoint of the PolarDB cluster.

  • A Domain Name System (DNS) server fails to resolve the endpoint of your cluster.
    • The endpoint that you enter to connect to the PolarDB cluster is invalid. In this case, troubleshoot the issue:
      • The endpoint of the PolarDB cluster is invalid. In this case, view the valid endpoints in the PolarDB console. For more information, see View endpoints and ports.
      • The endpoint that you enter is a public endpoint. However, the public endpoint is manually deleted.
      • Some applications have limits on the length of endpoints and the endpoint you enter is truncated.
    • If the endpoint of the PolarDB cluster is valid, change the IP address of the DNS server to that of the Alibaba Cloud DNS server.
      Network type IP address of the Alibaba Cloud DNS server
      Internal network (classic network) 10.143.22.116

      10.143.22.118

      Internal network (virtual private cloud) 100.100.2.136

      100.100.2.138

      Internet 223.5.5.5

      223.6.6.6