2

I'm trying to connect to my SQL Server Developer edition on my local Windows 10 Pro machine from a docker image created using Visual Studio Tools for Docker Desktop for Windows. I've followed the tutorial here. Which helped me make sure that SQL Server is functional and exposed to the outside world.

My preference would be to somehow start docker with NET=HOST and just use . to access my DB. But, I'm not sure how to do that and I'm not sure if that even works on Windows.

Now I can't seem to get the connection right to actually connect to SQL. I've tried these:

Server={MyIPv4Address}:434;Database=MyDB;
    MultipleActiveResultSets=true;User 
    Id=DeveloperLocalHost;Password=MyAwesomePassword

Server={MyIPv4Address};Database=MyDB;
    MultipleActiveResultSets=true;User 
    Id=DeveloperLocalHost;Password=MyAwesomePassword

Server=.;Database=MyDB;
    MultipleActiveResultSets=true;User 
    Id=DeveloperLocalHost;Password=MyAwesomePassword

I've tried many others from tutorials I have looked at online but don't remember them all. I'm a bit perplexed.

1 Answer 1

1

I would expect the second method (actual host IP and default 1433 port) to work as long as your SQL instance is configured to allow remote connections. Run this PS command from your container to verify port connectivity:

echo ((new-object Net.Sockets.TcpClient).Client.Connect("MyIPv4Address", "1433")) "connection successful"

Once you verify connectivity, you should be able to start the container with an environment variable and use that for your connection.

Sign up to request clarification or add additional context in comments.

1 Comment

Got me thinking. I went back through the tutorial and fixed the API port and the connection was then successful. Then I had to use a comma instead of a colon. stackoverflow.com/a/38755474/632495 - So, I was doing multiple things incorrect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.