Using client tools to connect to Babelfish
You can use a SQL Server client to connect with Babelfish on the TDS port. When connecting from a Windows system, SQL Server Management Studio (SSMS) or
sqlcmd are good choices of clients. If you are connecting to the TDS port from a Linux system,
sqlcmd is a good choice.
Other clients that speak the TDS protocol can also be used, but are not officially supported by Babelfish. On Linux, these include the FreeTDS command line tool
You can use any PostgreSQL client to connect to Babelfish on the PostgreSQL port.
psql and pgAdmin are examples of open-source clients that run on Windows and Linux platforms and speak the PostgreSQL protocol.
sqlcmd to connect to the DB instance
One way to connect to and interact with Babelfish is with the SQL Server
sqlcmd utility. A Babelfish connection string takes the following form:
sqlcmd -S host.sample.com,1433 -U PUT_USER_HERE -P PUT_PASSWORD_HERE -d PUT_DBNAME_HERE
-Sis the server name and TDS port of the DB instance.
-Uis the login name of the user.
-Pis the password associated with the user.
-dis the database to which you are connecting. This value is optional; if omitted, the client will connect to the
After connecting, you can use familiar T-SQL syntax to create and manage database objects.
Using SSMS to connect
SQL Server Management Studio (SSMS) is a commonly used SQL Server client. When loading SSMS, it may attempt to connect with the Object Explorer
Connect to Server dialog box. If this dialog box opens by default, hit
Cancel. Babelfish only supports connecting from the Query Editor.
Connecting with SSMS
Open the Connect to Server dialog by doing one of the following:
- If the Query Editor is open, choose
Provide the following information for your database:
Server type, choose
Server name, enter the DNS name followed by a comma and the TDS port. For example, your server name should look similar to the following:
SQL Server Authentication.
Login, enter the user name that you chose to use when you created your database.
Password, enter the password corresponding to that user name.
Options, and then choose the
Connect to database, specify the name of the database to connect to, and choose
If a message appears indicating that SSMS can’t apply the connection strings, choose
tsql to connect
tsql is a command line tool that is shipped as part of FreeTDS. It allows you to connect and to interact with Babelfish (or any other TDS enabled data source) from a Linux terminal.
A Babelfish connection string takes the following form:
tsql -S database.example.com -p 1433 -U postgres -P secretpassword
For information about using
tsql, consult the FreeTDS documentation.
tsql is not officially supported.
psql to connect
You can use PostgreSQL’s
psql client to connect to Babelfish on the PostgreSQL port (by default
psql supports PostgreSQL-style SQL syntax.
Here is an example how to connect with
psql -h database.example.com -p 5432 -U postgres -d dbname
Note that Babelfish ships with a modified version of
psql, which is intended for use by Babelfish development. This version is not intended for use in a production environment.