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
An RDS instance for which Babelfish is enabled is created. For more information, see Enable Babelfish for an ApsaraDB RDS for PostgreSQL instance.
A Babelfish account is created. For more information, see Manage Babelfish accounts.
A whitelist is configured to allow the server on which the client resides to access the RDS instance. For more information, see Configure an IP address whitelist for an ApsaraDB RDS for PostgreSQL instance.
The endpoints and TDS port of the RDS instance for which Babelfish is enabled are obtained. For more information, see View the endpoints and TDS port.
Procedure
Use TSQL (FreeTDS) to connect to the RDS instance
Run the following command to install TSQL (FreeTDS). In this example, CentOS 7 is used.
sudo yum install -y freetds
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.
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
Download and install sqlcmd. For more information, see Download and install sqlcmd in the official SQL Server documentation.
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.
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
Download and install SSMS. For more information, see Download SSMS in the official SQL Server documentation.
Open the SSMS client. In the menu bar, choose File > New > Database Engine Query.
Configure the parameters and click Connect.
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
NoteIf 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
Download and install Azure Data Studio. For more information, see Download and install Azure Data Studio in the official SQL Server documentation.
NoteIn this example, Azure Data Studio
1.45.1
is used.Open Azure Data Studio and click Create a connection.
Configure the parameters and click Connect.
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.