Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Unable to connect to SQL Server

Posted on 2010-09-23
7
1,281 Views
Last Modified: 2012-05-10
Hi,

I have a PC with Windows 7 Pro and SQL Server 2008 R2 installed and a laptop with Windows 7 Home and SQL Server 2008. I have added a Windows Firewall rule on the PC to allow incoming TCP connections on port 1433. Both the PC and the laptop are connected wirelessly to the same Homegroup network.

When I try to connect to the SQL Server 2008 R2 instance on the PC from SSMS on the laptop, I get the following error:

Cannot connect to MyPC\SVR1.
------------------------------
ADDITIONAL INFORMATION:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

I have deduced that the problem is caused by the Windows Firewall on the PC because when I disable it temporarily, the connection works fine. Can someone please advise me how to configure Windows Firewall on the PC so that it allows my remote connection from the laptop without unduly compromising security on the PC?

Thanks in advance.
0
Comment
Question by:irb56
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:carsRST
ID: 33748076
you need to open port 1433 on your firewall.  that's the default port for SQL Server.
0
 
LVL 16

Accepted Solution

by:
carsRST earned 500 total points
ID: 33748092
Here are some basic instructions for opening a port for windows firewall

http://support.microsoft.com/kb/308127
0
 

Author Comment

by:irb56
ID: 33748716
As far as I can tell, the Windows Firewall configuration has TCP port 1433 open. I found the following article which informed me that my named instance was listening on dynamic ports (http://technet.microsoft.com/en-us/library/ms177440.aspx). I used the SQL Server Configuration Manager to explicitly set to listen on port 1433. I restarted the service but still no luck connecting.

The following article, http://technet.microsoft.com/en-us/library/ms175043.aspx, told me how to configure Windows Firewall to open up SQL Server access for dynamic ports. As soon as I put this rule in the firewall, I am able to connect.

As far as I can tell, the server has TCP port 1433 open in the Windows 7 Firewall and is configured to listen on port 1433 (i.e. not use dynamic ports). Why can't I connect without this broad firewall rule that allows all remote connections to Sqlservr.exe regardless of port number?
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 16

Expert Comment

by:carsRST
ID: 33750388
With the dynamic ports, there's no guarantee which port it will pick.  And you definitely don't want to leave all open.  By configuring the way you have, windows firewall will allow which ever port is being used at the time access out...and only that port.
0
 

Author Comment

by:irb56
ID: 33761247
Thanks and you're right that I don't want to leave the firewall to allow access to SQL Server via any port (i.e. dynamic ports). I want to allow access to port 1433 only. I've configured Windows Firewall to open port 1433 and I've configured SQL Server (which is a named instance, not the default instance) to use port 1433 rather than dynamic port. I must have made a silly mistake in one of these two configurations, which I'm currently blind to. If someone can provide detailed list of things to check, that will be helpful.

Many thanks.
0
 

Author Comment

by:irb56
ID: 33763528
I worked out the problem. My mistake was made not in the firewall configuration but in the SQL Server Configuration Manager. In the network configuration for TCP/IP, I changed the TCP Dynamic Ports to blank and the TCP port to 1433. I did this for all IP address, IP1 to IP9. My mistake was that the IPAll entry was blank for TCP port and had a value of 49747 for TCP Dynamic Ports. Also I had accidentally set TCP Dynamic Ports to 1433 with a blank TCP port on IP7 (i.e. a transposition of what I meant to do).

Once I corrected the aforementioned configuration mistakes and disabled the firewall rule that allowed any port access to SQL Server (relying instead on the more restrictive TCP port 1433 only rule), my problem was resolved and I was able to connect to the SQL Server named instance remotely across my private network.
0
 

Author Closing Comment

by:irb56
ID: 33768116
My issue was actually caused by a configuration mistake in SQL Server Configuration Manager for TCP/IP rather than the Windows Firewall but thanks for your assistance as it seemed just as probable at the outset that I made a mistake in the firewall config.

See my posting on 26/09/10 for more details on how I solved the issue.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question