A network-related or instance-specific error occurred while establishing a connection to SQL Server

Here we go again! You are trying to connect to your freshly installed sql server 2008 R2 express edition using localhost as server name and you are getting this error.

 

The purpose of this article is to let you know that the fix might be as simple as connecting to the name instance instead of localhost. When you install sql server using the web platform installer tools  , the sql server is installed as a named instance so it is likely to be ComputerName\SQLEXPRESS not localhost.

If you are trying unsure about the server name please use the browse feature of this pop up to locate your server instance or use the command
sqlcmd -L
at the dos prompt.

If you can connect to your named instance but unable to connect to it from a nother comouter on the network you might have some configurations or firewall related issues . In such cases this article below is what you need. 
http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/

Reference and Related Links

Open a port windows Firewall

http://windows.microsoft.com/en-US/windows7/Open-a-port-in-Windows-Firewall

http://windows.microsoft.com/en-US/windows-vista/Open-a-port-in-Windows-Firewall

Let's share thisShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

3 comments Write a comment

  1. Thanks A LOT. I’ve been Googling this for hours, trying everything, and then it is this simple.

  2. GO START -> ALL PROGRAMS -> SQL SERVER 2008/2005/2008 R2
    ->CONFIGURATION TOOLS->
    ->SELECT SQL SERVER CONFIGURATION MANAGER
    ->SELECT SQL SERVER NETWORK CONFIGURATION
    ->SELECT PROTOCOLS FOR MSSQLSERVER(YOUR INSTANT NAME)
    ->IN RIGHT TASK PANEL
    ->MAKE SURE MENTION BELOW:

    DISABLE SHARED MEMORY AND VIA
    ENABLE NAMED PIPE AND TCP/IP

    —-MAKE SAME THING IN
    ->SQL NATIVE CLIENT 10.0(SERVER VERSION) CONFIGURATION – CLIENT PROTOCOLS

    RESTART SQL SERVER(MSSQLSERVER [YOUR INSTANT NAME]) SERVICE