Connect to an ApsaraDB RDS for PostgreSQL instance with Babelfish enabled using SQL Server clients over the Tabular Data Stream (TDS) port. This topic covers four clients: TSQL (FreeTDS), sqlcmd, SQL Server Management Studio (SSMS), and Azure Data Studio.
Babelfish supports two connection paths: SQL Server clients connect on the TDS port (default: 1433), and PostgreSQL clients connect on the PostgreSQL port. To connect over the PostgreSQL port, see Connect to an ApsaraDB RDS for PostgreSQL instance.
Known limitations
Before you connect, review this compatibility constraint:
SSMS Object Explorer is not supported. Babelfish is not fully compatible with all SQL Server system tables. Connecting through Object Explorer triggers a
Specified case is not validerror. Use File > New > Database Engine Query instead.
Prerequisites
Before you begin, ensure that you have:
An RDS instance with Babelfish enabled. For more information, see Enable Babelfish for an ApsaraDB RDS for PostgreSQL instance.
A Babelfish account. For more information, see Manage Babelfish accounts.
An IP address whitelist configured to allow your client host to access the RDS instance. For more information, see Configure an IP address whitelist for an ApsaraDB RDS for PostgreSQL instance.
The endpoint and TDS port of the RDS instance. For more information, see View the endpoints and TDS port.
Connect using TSQL (FreeTDS)
Install TSQL (FreeTDS). The following example uses CentOS 7.
sudo yum install -y freetdsConnect to the RDS instance.
tsql -S pgm-****.pg.rds.aliyuncs.com -p 1433 -U babelfish_user-S: The endpoint of the RDS instance, for example,pgm-****.pg.rds.aliyuncs.com.-p: The TDS port number, for example,1433.-U: The username of the Babelfish account, for example,babelfish_user.
Verify the connection by running a SQL query.
SELECT name FROM sys.databases; GOFor common SQL operations, see Common operations and compatibility description.
Connect using sqlcmd
Download and install sqlcmd. For more information, see Download and install sqlcmd in the Microsoft SQL Server documentation.
Connect to the RDS instance.
sqlcmd -S pgm-****.pg.rds.aliyuncs.com,1433 -U babelfish_user-S: The endpoint and TDS port in the formatEndpoint,Port, for example,pgm-****.pg.rds.aliyuncs.com,1433.-U: The username of the Babelfish account, for example,babelfish_user.
Verify the connection by running a SQL query.
SELECT name FROM sys.databases; GOFor common SQL operations, see Common operations and compatibility description.
Connect using SSMS
Do not use Object Explorer to create the connection. Babelfish is not fully compatible with all SQL Server system tables, so Object Explorer connections fail with a Specified case is not valid error. Use File > New > Database Engine Query as described below.
Download and install SQL Server Management Studio (SSMS). For more information, see Download SSMS in the Microsoft SQL Server documentation.
Open SSMS. In the menu bar, choose File > New > Database Engine Query.

Configure the connection parameters and click Connect.

Parameter Value Description Server type Database Engine Fixed value. Server name pgm-****.pg.rds.aliyuncs.com,1433The endpoint and TDS port in the format Endpoint,Port.Authentication SQL Server Authentication Fixed value. Login babelfish_userThe username of the Babelfish account. Password babelfish_pwdThe password of the Babelfish account.
Connect using Azure Data Studio
The following steps use Azure Data Studio 1.45.1 as an example.
Download and install Azure Data Studio. For more information, see Download and install Azure Data Studio in the Microsoft SQL Server documentation.
Open Azure Data Studio and click Create a connection.

Configure the connection parameters and click Connect.

Parameter Value Description Connection type Microsoft SQL Server Fixed value. Server pgm-****.pg.rds.aliyuncs.com,1433The endpoint and TDS port in the format Endpoint,Port.Authentication type SQL Login Fixed value. User name babelfish_userThe username of the Babelfish account. Password babelfish_pwdThe password of the Babelfish account. Encrypt Optional (False) Fixed value.
FAQ
Why does SSMS show `Specified case is not valid. (Micosoft.SqlServer.ConnectionInfo)` when I connect?
Babelfish is not fully compatible with all SQL Server system tables, so connecting through Object Explorer fails.


Use File > New > Database Engine Query instead to open the connection dialog directly.
