Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,19 @@ volumes:

### Step 3: connect and run your first query

You do not need to install anything: the container bundles sqlcmd, so this works for everyone. The `-C` flag trusts the container's self-signed certificate:
You do not need to install anything: the container bundles sqlcmd, so this works for everyone. Start with the bundled client and a short login timeout. If you started the container only seconds ago and see a transient startup failure such as `EOF`, wait a few seconds and rerun the same command. The `-C` flag trusts the container's self-signed certificate.

```bash
docker exec sqldb /opt/mssql-tools18/bin/sqlcmd \
-S localhost -U sa -P "YourStr0ng_Passw0rd" -C -Q "SELECT @@VERSION;"
-S localhost -U sa -P "YourStr0ng_Passw0rd" -C -b -l 2 -Q "SELECT @@VERSION;"
```

You should see `Microsoft SQL Azure`, confirming you are on the Azure SQL Database engine.

**Other ways to query:**

- **Already have [sqlcmd](https://learn.microsoft.com/sql/tools/sqlcmd/sqlcmd-utility) on the host?** Connect directly: `sqlcmd -S localhost,1433 -U sa -P "YourStr0ng_Passw0rd" -C -Q "SELECT @@VERSION;"`.
- **Already have [sqlcmd](https://learn.microsoft.com/sql/tools/sqlcmd/sqlcmd-utility) on the host?** First wait for the in-container command above to succeed, then connect directly: `sqlcmd -S localhost,1433 -U sa -P "YourStr0ng_Passw0rd" -C -b -l 2 -Q "SELECT @@VERSION;"`.
In PowerShell, retype the password quotes as plain ASCII `"` characters and do not include a leading space inside the password string. A pasted smart quote or extra space can cause an immediate `EOF`.
- **Ask your AI agent, no T-SQL required.** With the [container skill](prerequisites.md#agent-skill) installed, ask in plain English, for example: *"Connect to my local Azure SQL Database and show the version and edition."* It already knows the connection details and runs the query for you.
- **Use the VS Code MSSQL extension with GitHub Copilot.** Its [GitHub Copilot integration](https://aka.ms/vscode-mssql-copilot-docs) works against the container today, for example writing SQL from natural language or opening the schema designer. Connect with server `localhost,1433`, SQL Login, user `sa`, your password, and **Trust server certificate: Yes**. The extension's graphical UI is not yet fully compatible with the container, so some UI features may error; see [known limitations](known-limitations.md).

Expand Down
6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ <h3>Start the container</h3>
<span class="qstep-num">3</span>
<div class="qstep-body">
<h3>Connect and query</h3>
<p class="qstep-desc">Open a session with <a href="https://learn.microsoft.com/sql/tools/sqlcmd/sqlcmd-utility" rel="noopener">sqlcmd</a> and run your first query.</p>
<p class="qstep-desc">Use the bundled <a href="https://learn.microsoft.com/sql/tools/sqlcmd/sqlcmd-utility" rel="noopener">sqlcmd</a> and run your first query. If the container just started, wait a few seconds and retry.</p>
<div class="qstep-cmd">
<code><span class="cmd-p">$</span> sqlcmd -S localhost,1433 -U sa -C -h-1 \
<code><span class="cmd-p">$</span> docker exec sqldb /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "YourStr0ng_Passw0rd" -C -b -l 2 \
-Q "SET NOCOUNT ON; SELECT @@VERSION AS Version;"</code>
<button class="copy-btn" type="button" data-copy-text="sqlcmd -S localhost,1433 -U sa -C -h-1 \&#10; -Q &quot;SET NOCOUNT ON; SELECT @@VERSION AS Version;&quot;"><span class="copy-label">Copy</span></button>
<button class="copy-btn" type="button" data-copy-text="docker exec sqldb /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P &quot;YourStr0ng_Passw0rd&quot; -C -b -l 2 \&#10; -Q &quot;SET NOCOUNT ON; SELECT @@VERSION AS Version;&quot;"><span class="copy-label">Copy</span></button>
</div>
</div>
</div>
Expand Down
9 changes: 6 additions & 3 deletions skills/azuresql-db-container/references/connect-and-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ docker exec sqldb /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "YourStr0n
## sqlcmd from the host

Use the host port chosen by the free-port loop (here shown as `1433`). The
comma form `localhost,PORT` selects the port.
comma form `localhost,PORT` selects the port. If the container just started,
wait for the in-container command above to succeed before using the host client.

```bash
sqlcmd -S localhost,1433 -U sa -P "YourStr0ng_Passw0rd" -C -b \
sqlcmd -S localhost,1433 -U sa -P "YourStr0ng_Passw0rd" -C -b -l 2 \
-d appdb -Q "SELECT SERVERPROPERTY('Edition') AS Edition;"
```

Expect `SQL Azure`.
Expect `SQL Azure`. In PowerShell, retype the password quotes as plain ASCII `"`
characters and make sure there is no leading space inside the password string.
A pasted smart quote or extra space can cause an immediate `EOF`.

## Standard connection string

Expand Down
23 changes: 23 additions & 0 deletions skills/azuresql-db-container/references/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Common failures and their fixes. Symptoms first.
- Msg 40508 on USE
- Cannot open database / database does not exist
- Connecting too early (Msg 913 and friends)
- EOF from host sqlcmd
- Wrong image (EngineEdition is not 5)

## Container won't start / exits immediately
Expand Down Expand Up @@ -87,6 +88,28 @@ Errors right after `docker run` usually mean the engine is still initializing.
Use the readiness retry loop with `-b -l 2` so transient errors are retried
rather than masked. See `wait-until-ready.md`.

## EOF from host sqlcmd

An immediate `EOF` from host `sqlcmd` usually means either the engine is still
starting or the shell changed the `-P` password argument while pasting it.

First verify the container with the bundled client:

```bash
docker exec sqldb /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "YourStr0ng_Passw0rd" -C -b -l 2 \
-Q "SELECT 1;"
```

If that succeeds, retry from the host with the same short timeout:

```bash
sqlcmd -S localhost,1433 -U sa -P "YourStr0ng_Passw0rd" -C -b -l 2 -Q "SELECT 1;"
```

In PowerShell, retype the password quotes as plain ASCII `"` characters and
make sure there is no leading space inside the password string. A pasted smart
quote or a leading space inside the password string can trigger `EOF`.

## Wrong image (EngineEdition is not 5)

If `SELECT SERVERPROPERTY('EngineEdition')` does not return `5`, or
Expand Down