I am trying to connect to my local instance of SQL Server using a linux Docker container running on my Windows machine. I can connect successfully using Data Source=localhost
when running under Windows. I've discovered that localhost
is not supported in a connection string on linux, so here is what I've also tried and failed with:
Data Source=localhost
Data Source=localhost,1433
Data Source=127.0.0.1
Data Source=127.0.0.1,1433
Data Source=127.0.0.11
Data Source=127.0.0.11,1433
Data Source=172.23.0.1
- My local IP AddressData Source=172.23.0.1,1433
My local SQL Server instance does not allow remote connections. I suspect this is why I cannot connect. Do I need to allow remote connections to get this to work? Can I get this working without doing so?
Also, if I have to provide an IP address, is there a way to work out what that address should be programmatically?