Starting September 24, 2021, the default port number of new ApsaraDB RDS for PostgreSQL instance that you purchase is 5432. The default port number remains 1921 for existing ApsaraDB RDS for PostgreSQL instances.
Effective date
September 24, 2021
Description
The default port number of each new ApsaraDB RDS for PostgreSQL instance that you purchase is 5432.
Impacts
For an existing ApsaraDB RDS for PostgreSQL instance, the default port number is 1921.
For a new ApsaraDB RDS for PostgreSQL instance, the default port number is 5432. The following table describes the impacts of the change.
NoteFor more information about how to connect to an RDS instance, see Connect to an ApsaraDB RDS for PostgreSQL instance.
Connection method
Impact
Connection example
Use Data Management (DMS) to connect to the RDS instance
None.
You do not need to specify the port number.
You need to only configure the Instance ID, Database Account, and Database Password parameters.

Use the CLI to connect to the RDS instance
None.
You do not need to specify the port number. The client connects to the new ApsaraDB RDS for PostgreSQL instance over the default port 5432.
You need to only specify the endpoint of the new ApsaraDB RDS for PostgreSQL instance, the username of the authorized account, and the name of the database and enter a correct password.
psql -h <The endpoint of the RDS instance> -U <The username of the authorized account> -d <The name of the database>
Use SQL Shell (psql) to connect to an RDS instance
None.
You do not need to specify the port number. The connection is established over the default port number 5432.
You need to only configure the Server, Database, and Username parameters and enter a correct password.

Use pgAdmin to connect to the new ApsaraDB RDS for PostgreSQL instance
You no longer need to set the Port parameter to 1921.
The connection is established over the default port number 5432.
You need to only configure the Host name/address, Maintenance database, Username, and Password parameters.

Use an application to connect to the new ApsaraDB RDS for PostgreSQL instance
Pay attention to the port number in the business code.
Set the port number to 5432.
The following code snippet is an example that is suitable when the Java Database Connectivity (JDBC) API is used:
String url = "jdbc:postgresql://<The endpoint of the RDS instance>:5432/<The name of the database>"; String user = "<The username of the authorized account>"; String password = "<The password of the authorized account>"; Class.forName("org.postgresql.Driver"); Connection connection= DriverManager.getConnection(url, user, password);
References
For more information about how to change the port number of an ApsaraDB RDS for PostgreSQL instance, see View and change the internal and public endpoints and port numbers of an ApsaraDB RDS for PostgreSQL instance.