Since September 24, 2021, the default port number of each new ApsaraDB RDS PostgreSQL instance that you purchase is 5432. The default port number remains 1921 for existing ApsaraDB RDS PostgreSQL instances.

Effective date

September 24, 2021

Description

The default port number of each new ApsaraDB RDS PostgreSQL instance that you purchase is 5432.

Impact

  • 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.
    Note For more information about how to connect to a new ApsaraDB RDS for PostgreSQL instance whose default port number is 5432, see Connect to an ApsaraDB RDS for PostgreSQL instance.
    Connection method Impact Connection example
    Use Data Management (DMS) to connect to the new ApsaraDB RDS for PostgreSQL instance None.

    You do not need to specify the port number.

    You need only to configure the Instance ID, Database Account, and Database Password parameters.

    Use DMS for connection
    Use the CLI to connect to the new ApsaraDB RDS for PostgreSQL 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 only to 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 new ApsaraDB RDS for PostgreSQL instance> -U <The username of the authorized account> -d <The name of the database>
    Use CLI for connection
    Use SQL Shell to connect to the new ApsaraDB RDS for PostgreSQL instance None.

    You do not need to specify the port number. The connection is established over the default port number 5432.

    You need only to configure the Server, Database, and Username parameters and enter a correct password.

    Use SQL Shell for connection
    Use pgAdmin to connect to the new ApsaraDB RDS for PostgreSQL instance Pay attention to the Port parameter. You no longer need to set this parameter to 1921.

    The connection is established over the default port number 5432.

    You need only to configure the Host name/address, Maintenance database, Username, and Password parameters.

    Use pgAdmin for connection
    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 new ApsaraDB RDS for PostgreSQL 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.