Windows – Cannot connect to SQL Server 2012 Express instance outside a VM

hyper-vsql serverwindows

I'm trying to connect to a SqlServer instance – located in my host machine – from my VM, using Sql Server Management Studio.

From my host I can connect to both SQL instances using SSMS, but when I try to connect to the host instance from the VM, SMSS gives this error message (mine is in PT-BR):

enter image description here

My environment is like this: the blue dotted block represents my host (PC_MASTER) and the orange dotted block represents my VM (MYVM):

enter image description here

Here are the main components in each machine:

PC-MASTER (Host): Windows 8 PRO-English w/ SQL Server 2012 Express. SQL instance name is "PC-MASTER\SQLEXPRESS".

MyVM (VM): Windows Server 2012 BR-Portuguese w/ SQL Server 2012 Standard. SQL instance name is "MYVM".

Firewall: The host has an inbound rule opening the 1433/1434 TCP ports for all programs/services;

SQL Protocols: In both servers all 3 main protocols are on, in the following order: Shared Memory, TCP/IP and Named Pipes;

Remote Access: Both SQL servers are configured to allow remote connections;

SQL Configuration: The host SQL is configured to allow only static access through the port 1433, as Somantra pointed out.

From my VM(MYVM):

  • I can only connect to the local SQL instance.
  • I can ping the host successfully using either its IP or its name;
  • I cannot connect to the host using telnet: I tried the ports 21, 23, 80, 1433 and 1434.

Tks!

Best Answer

So I spent a few minutes looking at all the duplicates of this problem, and there are a few, but to be honest they all kind of sucked in terms of their answers, so here we go:

Port 1433 is only good for default instances of SQL Server. If you are going to connect to a named instance, you have two options:

  1. Use SERVER\INSTANCE name and open ports 1434 (for SQL Browser) and the port of your SQL Server Instance (more on that later)
  2. Use SERVER:port where port is the port of your SQL Server Instance

To determine which port your SQL Server instance is running on in the SQL Server Configuration Manager, under Network Configuration > TCP/IP > IP Addresses:

enter image description here

So for #1 I need to open 1434 and 64670 and for #2 I just need to open 64670, but use a different SQL connection string.