Can't connect to SQL Server in docker from Hyper-V virtual machine - sql-server

I have a SQL Server instance in docker which maps its port 1433 to host 1433.
It's working and I connect to it.
Next, I have a Windows (actually, its old Windows 7) virtual machine in Hyper-V on same host. Virtual machine can see host (to be specific at ip 192.168.10.1).
But from virtual machine I can not connect to SQL Server on port 1433. I can't simply open a socket from virtual machine (have tried though python).
I've tried to stop docker container and start simple web server on 1433 port and I can easily connect to it from virtual machine. But once SQL Server appears there, something goes wrong.
Any ideas, what may be wrong or what to check (just got a humble idea that may be caused by MTU, but not yet checked - makes sense?)

Related

All but one Windows 11 Surface Tablet can make remote connection to SQL Server

I have SQL Server Express 2017 running on Windows Server 2016 Standard (default instance, not named). It has remote connections enabled and is listening on port 1433 and has TCP/IP and Named Pipes enabled. I have several Surface Tablets running Windows 10 and Windows 11. These tablets make a VPN connection to the server to connect to SQL Server. All of the tablets, except one of them, can connect to SQL Server. All tablets connect using the server's IP address and with SQL Server Authentication. All tablets are connected to the same WiFi router - both the ones that CAN connect and the one that CANNOT, so I believe router settings are not the problem.
The tablet that fails to connect can ping the server successfully. It cannot, however, telnet to port 1433 on the server - this times out. All other tablets can make the telnet connection. Also, using sqlcmd to connect (sqlcmd -S ip-address -U user-name -P password) works on all tablets except the one. This returns error 53. Checking the SQL Server logs after attempting to connect using sqlcmd shows no errors. So this tablet is definitely not even reaching SQL Server.
I have disabled all Windows Firewall options on the tablet with no change - still cannot telnet or connect via sqlcmd.
I have walked through multiple remote connection troubleshooting guides step by step, but most of them assume that NO remote systems can connect to SQL Server. In this case, it is just one system. So I know that the server is configured properly to allow remote connections. I just cannot determine what is different about this one tablet that is preventing it from making a connection.
What might be preventing this one system from making this connection? Any settings or other options I should be looking at?
SOLVED: After performing tracert on multiple systems that connect to this server including the problem tablet as well as attempting to telnet to various ports at the server's IP address, I discovered that the WiFi network that the tablet was on had a conflicting IP address with the server. The previous tablets that tested fine were, unbeknownst to me, on different wifi networks that did not have this conflict. As a result, this tablet was attempting to connect to a completely different device despite being properly connected to the server's network via VPN.
So the additional piece of advice to add to this troubleshooting process would be to very closely scrutinize the output of ipconfig /all. Even though you may be connected to the network of the SQL Server system you are trying to connect to remotely, if the IP of the SQL Server system is duplicated on your local network, it can be very difficult to see that all of your connection attempts are actually routing to a different system - that is why the connection is failing.
What to look for in ipconfig /all... check the client system's IP address and the default gateway that it is using. If these are using private IP addresses (as most do) most commonly starting with 192.168.x.x, and you are trying to connect to SQL Server over VPN via which the server also has a private IP address, check if your local subnet is matching the server's subnet. For instance, both the client (tablet) subnet and the server subnet were 192.168.20.x There's a chance for an IP address conflict in these conditions.
Another check that I found was helpful was, on the client, to DISCONNECT from the remote server and then try to ping the SQL Server IP address. If the ping succeeds, the server's IP address is being duplicated by another system.

Connecting to SQL Server in Parallels from Docker on Mac

I'm currently having a Macbook Pro M1 as my development machine, running Docker on Mac for my containerised applications and Windows 11 VM using Parallels as my development environment. In this Windows VM lies the SQL Server database that Docker needs to connect to. To those who may be unaware, no, the M1 chip doesn't support nested virtualisation.
Therein lies my question: how do I establish a connection from Docker through the MacOS host to SQL Server in Windows VM?
Points that I'm aware of:
There is no direct connection between Docker and Windows
Docker has its own subnet assigned by default e.g. 192.168.65.0/24
Parallels uses shared network by default, which places the Windows VM in an invisible subnet e.g. 10.211.55.x
Parallels support bridged network but ideally would like the corporate VPN to just be in the MacOS host
Inside Mac's host file, an entry exists to resolve the private IP of the Windows VM to a hostname e.g. 10.211.55.x windows-11.shared
Docker uses a specific hostname to establish a connection to the MacOS host i.e. host.docker.internal
SQL Server is configured to accept TCP connections through port 1433
Using the connection string Server=windows-11.shared;Database=xxx;User ID=xxx;Password=xxx throws the "Server not found" error because no direct connection
Advice greatly appreciated!

How to Enable TCP/IP for mssql instance in ubuntu 16.04?

I'm not able to connect SQL Server hosted in Ubuntu 16.04 using my program, I believe its because the TCP/IP is disabled for the instance I try to connect (Protocols for SQLEXPRESS under SQL Server network configuration).
How I'm sure because I tried to connect my program to SQL Server that hosted in Windows and it able to connect.
Example my instance name is SQLEXPRESS, so I'm trying to connect through SSMS by using IP Adress\SQLEXPRESS and it fails. But I am able to connect to the SQL if I use IP address only as the server name.
I tried to search about sqlcmd for enable the tcp/ip but all of them just show the guide to change the ports.
So, how can I enable tcp/ip connection for ip\SQLEXPRESS instance in Ubuntu 16.04?
picture below just an example on enabling tcp/ip for the sql instance in windows
I believe the reason why this doesn't work on linux is because it doesn't have a SQL Server Browser application that Windows has available. This application redirects the requests to 1433 to whatever random port it's listening to currently -- this is why it will only connect when the port is specified. In my case this stinks because I'm having to work around an ancient application that we don't have the source code for. I'm thinking about writing a little application that will redirect the default traffic to the correct port for linux msssql.

Cannot connect to Azure VM with SQL Server

I cannot get my Azure VM with SQL Server to connect from anything other than the local machine. This is a Windows VM where I downloaded and installed SQL Server manually. I am at a loss.
If I RDP to the machine and connect to SQL Server it succeeds. If I attempt to hit it from any other box on my Virtual Network it will not connect. I can ping the box and the name resolves to the proper IP address. Test-NetConnection shows that I cannot connect on port 1433, but I can connect on other ports like 3389.
Here is all I've tried/confirmed thus far.
TCP/IP is enabled in configuration manager and set to listen on port 1433. Remote access is enabled in configurations.
I added a port 1433 Windows firewall rule for all 3 profiles.
I turned off the Windows firewall for all 3 profiles.
Confirmed both machines are definitely on the same virtual network.
The default NSG rule is in place for any port/protocol on the same Virtual Network.
I added an explicit NSG rule for the source IP of another machine to any port/protocol.
I modified the rule that allowed me to RDP to the box from my personal IP to include 1433 in addition to 3389. Test-NetConnection succeeds on 3389 and fails on 1433.
None of these made a difference.
I created a new VM where the machine came pre-installed with SQL Server. It connects just fine from any other machine on the VirtualNetwork without making any changes to any firewall or NSG rules.
What am I missing?
Is SQL listening on the internal address and an allowed connection IP? http://www.mohamedmostafa.co.uk/blog/2009/10/10/setup-configure-microsoft-sql-server-to-allow-remote-connection-remote-sql-management-studio-access/
Sound like your MSSQL is setup with a dynamic port in the tcp/ip protocol. Check the TCP/IP protocol and if the port is blank, set it to the desired port (1433) and set NSG to allow communication on this port.

connecting biztalk to sql server on virtual pc

I have biztalk server installed on my host(physical machine) and i need to connect or use the sql server on my virtual pc 2007 machine.i have been running the virtual pc in loopback adapter networking mode but when i try to configure biztalk on the host machine it is not able to connect to the sql server on the virtual pc. it says
the database server you specified cannot be reached.any suggestions...
You will probably need to change the networking mode on the virtual machine. In VirtualBox you can configure port forwarding for this. There may be something similar in Virtual PC.

Resources