How to enable remote connections in SQL Server 2008?

How to enable remote connections in SQL Server 2008?

Rate This
  • Comments 94

You experience the following error message:

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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
SQL Server 2008: The server was not found or was not accessible.

How to solve this issue?

There are a couple of things that might be going on here… (All of the following configurations are made on the computer running your SQL Server 2008 instance)

Allow remote connections to this server

The first thing you want to check is if Remote Connections are enabled on your SQL Server database. In SQL Server 2008 you do this by opening SQL Server 2008 Management Studio, connect to the server in question, right click the server…

SQL Server 2008: Server Properties

… and open the Server Properties.

SQL Server 2008: Server Properties - Connections

Navigate to Connections and ensure that Allow remote connections to this server is checked. Check if this solves the problem. If it does, here you go, continue with whatever you were doing and have a nice day.

Protocols for MSSQLServer

If you’re still running in issues let’s dig a bit deeper. The next good thing to check is the SQL Server Network Configuration. Open the SQL Server Configuration Manager, unfold the node SQL Server Network Configuration and select Protocols for MSSQLServer (or whatever the name of your SQL Server instance is).

SQL Server 2008: Protocols for MSSQLServer

Make sure that TCP/IP is enabled and try again. Even though I hope that this resolved your problems there might still be an issue with…

The Firewall

If there is still no communication happening between your computer and the remote SQL Server you most likely need to configure your firewall settings. A good first step is to figure out which port is being used by TCP/IP (and which you need to open in your firewall). You can do this by right clicking TCP/IP and selecting Properties.

SQL Server 2008: TCP/IP Properties

Click on the tab IP Addresses and voilà – Port 1433 it is :-) That was easy enough and all there is left to do is to allow inbound TCP/IP traffic on Port 1433 in your firewall. In Windows 7 this works something like this. Open the Control Panel and navigate to Windows Firewall.

Microsoft Windows 7 Firewall settings

Click on Advanced Settings on the left hand side and you should see the Windows Firewall with Advanced Security. Select the Inboud Rules on the left hand side and click on New Rule… on the right hand side.

Microsoft Windows 7 Firewall with Advanced Security

This opens the New Inbound Rule Wizard which you can use to allow inbound traffic on Port 1433 for TCP/IP (and which is exactly how you configured your SQL Server in the steps above). Just follow the steps outlined below and you should be good :-)

New Inbound Rule Wizard - Protocols and Ports

New Inbound Rule Wizard - Protocols and Ports

New Inbound Rule Wizard - Action

New Inbound Rule Wizard - Profile

New Inbound Rule Wizard - Name

That’s it, success! From here you should be able to access your SQL Server remotely. Enjoy!

Cheers!

   Daniel

P.S. There's a good article on msdn on this topic if you're looking for additional information >> Configuring the Windows Firewall to Allow SQL Server Access.

Update (June 14th, 2010):

 

Leave a Comment
  • Please add 8 and 8 and type the answer here:
  • Post
  • I see red X's instead of your screenshots.

  • it is very good article.Thank you indeed.

  • Hey Daniel,

    very nice article!

    One comment:  Many enterprise firewalls are blocking the UDP-Ports.  By default SQL-Server-Browser-Services use UDP-Port 1433.  System administrators are not very happy when you ask them to open UDP-Ports, because they are frequently used for cyber-attacks.  

    If SQL-Server-Browser-Services are not available, you cannot find the named instance of you server.  An easy workaround is to append the TCP-Port of your server instance (in this case 1433) to the server address (e.g. 234.567.123.23, 1433)

    Not using SQL-Server-Browser-Services and blocking UDP-Ports makes systems much safer at no cost of usability.

    cheers

  • @Oliver >> do you still have issues seeing the pictures?

    @Gerhard >> Great tip! Thanks very much!

  • Thank you!! This is a very good article and it sorted my problem out. So much for the technet and MSDN online help.

  • How to enable remote connections in SQL Server 2008 into Windows Server 2008 R2 Core?

  • thank u so much ...it helps me lot..keep up ur good work.

  • Step 1>Install MS SQL server 2008

    Step2>During Istallation Always Select MIXED User connection;

    Step3>after successful installation of data base Login as Local User.and create Database..then in side Database select security

    and then right click on login and create new Login.

    Step4>give new User name and Select SQL Authentication..and give password then deselect USE MUST CHANGE PASSWORD AT NEXT LOGIN

    Step5>Go to USER MAPPING on that form and select database wihich u want to assign to that User.and below that assign

    read,write,backup permission.and then Click "ok" to finish.

    Step6>NOW open SQL Server Configuration Manager->SQL Server Network Configuration->Protocols for <Instance Name>->Enable Shared

    Memory & TCP/IP and Double Click on TCP/IP then got to IPaddress TAB->in here ScrollDown and look "IP ALL"there give TCP Port

    "1433" then "ok".

    Step7>Now Go to SQL NATIVE Client xx.x Configuration->Client Protocols->Enable Shared memmory and TCP/IP->Double click on Client

    Protocols and Default Port =1433

    Step8 Optional Client side>Go to Aliases and create new Alias.eg-Alias name=xyz,)port no=1433,Protocol=TCP/IP,Server=Ip Add

    (192.168.1.1) or DomainName\InstanceName(JOI-MI\MSSQLSERVER)

    Step9>do Step 6 & 7 in client Side.

    Note:-Remember Do all settings of SQL Server Configuration Manager in 32-bit version.ull see don't worry.

    Use this Connection string ->

    cnn = New SqlConnection("Data Source=<Alias name/ipaddress,port>;Network Library=DBMSSOCN;Initial Catalog=DATAbaseNAME;User

    ID=SQLCreatedUSERname;Password=Pass;")

  • Thank you so much for this.  Saved me at midnight for a launch tomorrow!

  • I didn't try your solution yet, but realy I want to thank you very much for your explanation.

  • I tried till the step of enabling TCP. I still could not connect to database remotely. Windows firewall was off. I restarted sql server service. Then it worked :)

  • what kind o microsoft IDIOT mind this ?

    what for ???

    this way Everybady open ALL !

    IDIOT !!!

  • have you can do this automaticly with code

  • This is good guide, but you forgot that it is needed to create specific username and password to establish connections to the server, also select wich logins are going to be used to access the database, this is could be all done from the management studio, and the most important is you should enable sql server authentication and windows from the properties -> security. more info: videotutors.net/sqlserver-remote-access.aspx

  • Thanks you dear this is very helpful document i have deployed its successfully.

Page 1 of 7 (94 items) 12345»