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 PolarDB-O JDBC.
- For more information about how to use .NET to connect to Apsara PolarDB, see PolarDB-O .NET.
- For more information about how to use ODBC to connect to Apsara PolarDB, see PolarDB-O ODBC.
- For more information about how to use OCI to connect to Apsara PolarDB, see PolarDB (compatible with Oracle) OCI.
- 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.
- Launch the pgAdmin 4 client.
- Right-click Servers and choose , as shown in the following figure.
- On the General tab of the Create - Server dialog box that appears, enter the name of the server, as shown in the following
- Click the Connection tab and specify the information of the destination instance. These parameters are
listed in the following table.
Table 1. Parameters Parameter Description Host name/address
Enter the endpoint of the PolarDB-O cluster. To view the endpoint and port information of the PolarDB-O cluster, perform the following steps:
- Log on to the Apsara PolarDB console.
- In the upper-left corner of the console, select the region where the cluster is deployed.
- Find the target cluster and click the cluster ID.
- In the Endpoints section, view the endpoint and port information.
Port The port of the cluster. Default value: 1521. Maintenance database Enter the maintenance database. Default value: postgres. Username The username of the account of the PolarDB-O cluster. For more information, see Create database accounts. Password The password of the account for the PolarDB-O cluster.
- Click Save.
- If the connection information is valid, the following page appears after you click
the database name. This indicates that the connection is established.
- Right-click the target database and click Query Tool.... On the following page, you can add, delete, update, and query data in the database.
- 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 cluster. Therefore, you must add IP addresses to the whitelist. For more information, see Configure a whitelist for a cluster.
- You have added 0.0.0.0 to the whitelist. The required format is 0.0.0.0/0.
Notice The CIDR block 0.0.0.0/0 indicates that all IP addresses are allowed to access the cluster. Use this CIDR block with caution.
- The public IP addresses you add to the whitelist are invalid. For example, the public IP address may be a dynamic IP address. The tools or websites used to query the public IP addresses provide invalid incorrect IP addresses.
- The internal or public endpoint is incorrectly used in the corresponding network.
The connection fails when you use an internal endpoint to connect over the Internet or use a public endpoint to connect over an internal network.
Use the required endpoint. If you want to connect to an Apsara PolarDB cluster over an internal network, you must use an internal endpoint. If you need to connect to the cluster over the Internet, you must use a public endpoint.