1

I am working with a MacBook M1 that runs a SQL Server database using microsoft-azure-sql-edge image. On the same laptop is running a Win 11 VM using Parallels where SQL Server Management Studio is installed.

The issue is that I can't connect to the database from the Windows VM. I tried to give a hostname to the database container and connect it to the host network using this docker compose config:

version: "3.9"

services:
  mssql:
    image: mcr.microsoft.com/azure-sql-edge:latest
    command: /opt/mssql/bin/sqlservr
    environment:
      ACCEPT_EULA: "Y"
      SA_PASSWORD: ${SAPassword}
    stdin_open: true
    container_name: sqlserver
    hostname: sqlserver
    network_mode: host
    ports:
      - 1433:1433

I tried to set sqlserver as server name and enter the login for sa but I get an error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
chenny
  • 769
  • 2
  • 17
  • 44
  • 2
    Why don't you just use Azure Data Studio on the host? Especially if you only have parallels _for SSMS_? – Aaron Bertrand Jan 21 '23 at 13:19
  • I am having permission issues on the database and since I already had Parallels I wanted to use SSMS and it's interface to check the current permissions and try to fix the issue. – chenny Jan 21 '23 at 13:34
  • 2
    The `sa` `LOGIN` can literally do *anything* on the instance, so if you are getting permission issues this suggests something else. This smells like an [XY Problem](//xyproblem.info) – Thom A Jan 21 '23 at 13:40
  • Sorry, I didn't explain it correctly. The permissions issue is happening with another login I created for the application. I ask about that [here](https://stackoverflow.com/q/75193708/1752757). So I wanted to connect to the database as `sa` and check the permissions using SSMS' interface from the Parallels VM but I have this network error. – chenny Jan 21 '23 at 13:46

1 Answers1

0

Assuming a typical Parallels installation and your configuration is following something like this: https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker

  1. On your Mac OS, open a Terminal.
  2. Run ifconfig to find your Bridge IP which will be something like 10.211.55.2 (not your 192.168.x.x).
  3. Ensure that your SQL Server container is running in docker.
  4. In SSMS, connect using that IP address as the server name, use your docker configured SA login setting authentication type to SQL Server Authentication.

That's it!

Sean Chase
  • 1,139
  • 1
  • 15
  • 23