Skip to content

Commit

Permalink
Improved consistency of grammar and added note about connecting on SS…
Browse files Browse the repository at this point in the history
…MS (#185)

This update improves the grammar in the command-line.md file, and adds warning from Simon about connecting on SSMS.

Signed-off-by: susanmdouglas [email protected]
  • Loading branch information
susanmdouglas-aws authored Mar 10, 2022
1 parent dbf9a82 commit 95089a9
Showing 1 changed file with 30 additions and 45 deletions.
75 changes: 30 additions & 45 deletions _usage/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,101 +22,86 @@ Windows and Linux platforms and speak the PostgreSQL protocol.

### Using `sqlcmd` to connect to the DB instance {#babelfish-connect-sqlcmd}

The most common way to connect to and interact with Babelfish
is with the SQL Server `sqlcmd` utility, as shown in the following.

One way to connect to and interact with Babelfish is with the SQL Server `sqlcmd` utility. A Babelfish
connection string takes the following form:

```bash
sqlcmd -S host.sample.com,1433 -U PUT_USER_HERE -P PUT_PASSWORD_HERE -d PUT_DBNAME_HERE
```

Where:

- `-S` is the server name and port of the DB instance.
- `-S` is the server name and TDS port of the DB instance.
- `-U` is the login name of the user.
- `-P` is the password associated with the user.
- `-d` is the database that is selected initially.
- `-d` is the database to which you are connecting. This value is optional; if omitted, the client will
connect to the `master` database.

After connecting with `sqlcmd`, you can use familiar T-SQL syntax to create and
manage database objects.
After connecting, you can use familiar T-SQL syntax to create and manage database objects.

### Using SSMS to connect

SSMS is one of the most commonly used clients to connect to Babelfish.

In the following procedure, you connect to your Babelfish database by
using SSMS. You can use the SSMS query editor to connect to a Babelfish database.


>
> _You **can't currently connect using the SSMS Object Explorer**._
>
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

1. Open the Connect to Server dialog by doing one of the following:

- Choose “New Query”.
- If the Query Editor is open, choose “Query” –
“Connection” – “Connect”.
- Choose `New Query`.
- If the Query Editor is open, choose `Query` –
`Connection` – `Connect`.

2. Provide the following information for your database:

- For “Server type”, choose “Database Engine”.
- For `Server type`, choose `Database Engine`.

- For “Server name”, enter the DNS name. For example, your server
- For `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:

```none
host.example.com,1433
```
- For “Authentication”, choose “SQL Server
Authentication”.
- For `Authentication`, choose `SQL Server Authentication`.
- For “Login”, enter the user name that you chose to use when you
- For `Login`, enter the user name that you chose to use when you
created your database.
- For “Password”, enter the password corresponding to that user name.
- Optionally, choose “Options”, and then choose the
“Connection Properties” tab.
- For “Connect to database”, specify the name of the database
to connect to, and choose “Connect”.
3. If a message appears indicating that SSMS can't apply connection
strings, choose “OK”.
- For `Password`, enter the password corresponding to that user name.
- Optionally, choose `Options`, and then choose the
`Connection Properties` tab.
#### Limitations
- For `Connect to database`, specify the name of the database
to connect to, and choose `Connect`.
As previously stated, currently you can not connect using the SSMS Object Explorer.
3. If a message appears indicating that SSMS can't apply the connection
strings, choose `OK`.
### Using `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 your Linux terminal.
from a Linux terminal.
Here is an example how to connect to Babelfish with `tsql`:
A Babelfish connection string takes the following form:
```bash
tsql -S database.example.com -p 1433 -U postgres -P secretpassword
```

For information about using `tsql`, consult
[the FreeTDS documentation](https://www.freetds.org/userguide/).
For information about using `tsql`, consult [the FreeTDS documentation](https://www.freetds.org/userguide/).

Note that `tsql` is not officially supported.


### Using `psql` to connect

You can also use PostgreSQL's `psql` to connect to Babelfish. `psql` has to
connect to the PostgreSQL port (by default 5432), and you will have to use
PostgreSQL SQL syntax instead of T-SQL.
You can use PostgreSQL's `psql` client to connect to Babelfish on the PostgreSQL port (by default `5432`).
`psql` supports [PostgreSQL-style SQL syntax](https://www.postgresql.org/docs/current/sql-commands.html).

Here is an example how to connect with `psql`:

Expand All @@ -125,5 +110,5 @@ 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 can produce incorrect results,
and should not be used in production.
for use by Babelfish development. This version is not intended for use in a production
environment.

0 comments on commit 95089a9

Please sign in to comment.