All Products
Search
Document Center

ApsaraDB RDS:Use clients to establish connections

Last Updated:Sep 18, 2023

This topic describes how to use clients, such as TSQL (FreeTDS), sqlcmd, SQL Server Management Studio (SSMS), and Azure Data Studio, to connect to an ApsaraDB RDS for PostgreSQL instance for which Babelfish is enabled over the Tabular Data Stream (TDS) port.

If you want to connect to the RDS instance over the PostgreSQL port, see Connect to an ApsaraDB RDS for PostgreSQL instance.

Prerequisites

Procedure

Use TSQL (FreeTDS) to connect to the RDS instance

  1. Run the following command to install TSQL (FreeTDS). In this example, CentOS 7 is used.

    sudo yum install -y freetds
  2. Run the following command to connect to the RDS instance:

    tsql -S pgm-****.pg.rds.aliyuncs.com -p 1433 -U babelfish_user

    The following table describes the parameters.

    Parameter

    Example

    Description

    -S

    pgm-****.pg.rds.aliyuncs.com

    The endpoint that is used to connect to the RDS instance.

    -p

    1433

    The TDS port number.

    -U

    babelfish_user

    The username of the Babelfish account.

  3. Perform a simple SQL query. For more information, see Common operations and compatibility description.

    SELECT name FROM sys.databases;
    GO

Use sqlcmd to connect to the RDS instance

  1. Download and install sqlcmd. For more information, see Download and install sqlcmd in the official SQL Server documentation.

  2. Run the following command to connect to the RDS instance:

    sqlcmd -S pgm-****.pg.rds.aliyuncs.com,1433 -U babelfish_user

    The following table describes the parameters.

    Parameter

    Example

    Description

    -S

    pgm-****.pg.rds.aliyuncs.com,1433

    The endpoint and port number that are used to connect to the RDS instance.

    The value is in the format of Endpoint,Port number.

    -U

    babelfish_user

    The username of the Babelfish account.

  3. Perform a simple SQL query. For more information, see Common operations and compatibility description.

    SELECT name FROM sys.databases;
    GO

Use SSMS to connect to the RDS instance

  1. Download and install SSMS. For more information, see Download SSMS in the official SQL Server documentation.

  2. Open the SSMS client. In the menu bar, choose File > New > Database Engine Query.

    新建连接
  3. Configure the parameters and click Connect.

    连接PG

    The following table describes the parameters.

    Parameter

    Example

    Description

    Server type

    Database Engine

    The value of this parameter is fixed.

    Server name

    pgm-****.pg.rds.aliyuncs.com,1433

    The endpoint and port number that are used to connect to the RDS instance.

    The value is in the format of Endpoint,Port number.

    Authentication

    SQL Server Authentication

    The value of this parameter is fixed.

    Login

    babelfish_user

    The username and password of the Babelfish account.

    Password

    babelfish_pwd

    Note

    If the Specified case is not valid. (Micosoft.SqlServer.ConnectionInfo) error message is displayed during the connection, resolve the issue based on FAQ.

Use Azure Data Studio to connect to the RDS instance

  1. Download and install Azure Data Studio. For more information, see Download and install Azure Data Studio in the official SQL Server documentation.

    Note

    In this example, Azure Data Studio1.45.1 is used.

  2. Open Azure Data Studio and click Create a connection.

    创建连接
  3. Configure the parameters and click Connect.

    image.png

    The following table describes the parameters.

    Parameter

    Example

    Description

    Connection type

    Microsoft SQL Server

    The value of this parameter is fixed.

    Server

    pgm-****.pg.rds.aliyuncs.com,1433

    The endpoint and port number that are used to connect to the RDS instance.

    The value is in the format of Endpoint,Port number.

    Authentication type

    SQL Login

    The value of this parameter is fixed.

    User name

    babelfish_user

    The username and password of the Babelfish account.

    Password

    babelfish_pwd

    Encrypt

    Optional (False)

    The value of this parameter is fixed.

FAQ

What do I do if the Specified case is not valid. (Micosoft.SqlServer.ConnectionInfo) error message is displayed?

  • Cause: Babelfish is not fully compatible with all system tables of SQL Server. You cannot create a connection by using Object Explorer.

    对象资源管理器报错
  • Solution: In the menu bar, choose File > New > Database Engine Query to create a connection. For more information, see Use SSMS to connect to the RDS instance.

    新建连接