Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Unable to connect to SQL Server

Posted on 2010-09-23
7
Medium Priority
?
1,299 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
[X]
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
  • 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 1500 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

688 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