13

When I am trying to connect to my database in SQL Server Management Studio, I getting this error:

Provider named pipes provider error 40 could not open a connection to SQL Server error

After checking several answers on SO, I opened the SQL Server Configuration Manager

I found SQLSERVER (SQLEXPRESS) and all three options state >> STOPPED

I tried it starting by right clicking on it, but i got below error:

The request failed or the service did not respond in a timely fashion

How can I connect to the instance???

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
C Sharper
  • 8,284
  • 26
  • 88
  • 151

9 Answers9

13

Well I have an easy solution for your question. Follow the steps:

  1. Go to SQL Server Configuration manager
  2. SQL Server Network Configuration:
  3. Protocol for MSSQLSERVER
  4. In the right pane split page you will have to disable VIA as follows
    1. Shared Memory - Enable
    2. Named Pipes - Enable
    3. TCP/IP - Enable
    4. VIA - Disable
senshin
  • 10,022
  • 7
  • 46
  • 59
Kailash Sapkota
  • 131
  • 1
  • 3
  • 1
    How to start SQL Server Configuration Manager https://msdn.microsoft.com/en-us/library/ms174212.aspx – Iouri Goussev Jan 05 '17 at 18:51
  • To start the configuration manager just search for the application through your OS (for windows just click the start button and search configuration manager) – jthort Aug 22 '17 at 14:14
5

Search for services in control panel, there you will find and entry View Local Services in Admin tool section

select it that will show a window with all services in your system, find your service SQLEXPRESS and click on Start. It should start your server instance :)

enter image description here

2

In Sql Server Configuration Manager program, start SQL SERVER, enable the TCP/IP connection. After, allow the port in the firewall to be sure that's ok.

Ema.H
  • 2,862
  • 3
  • 28
  • 41
2

It's a generic error so it can be a lot of things. I got this error once and when I added port number (1433) to my connection string everything started to work again.

<connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=Server,1433;Initial Catalog=Test;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
</connectionStrings>
Ogglas
  • 62,132
  • 37
  • 328
  • 418
1

I have provided steps to fix your issue Provider named pipes provider error 40 could not open a connection to SQL Server error as below:

  1. Confirm for working fine SQL Server Services services.
  2. Confirm for working fine SQL Server (MSSQLSERVER).
  3. Confirm for working fine SQL Server Browser.
  4. Delete all your previous Aliases and now create new aliases as per your requirements.
  5. Now assign your SQL Server Default Port 1433
  6. Now click on Client Protocols in instance, click on TCP/IP in right pane, now click on mouse right click, open Property, here you can check for your default port of SQL 1433
  7. Run your SQL Server Management Studio, then right click, click on property option and then click on Connections on tab, now check for Allow remote Connections to this server.
  8. Confirm for Ping IP Host or not
  9. Check for your Firewall setting not to blocking your SQL Server port
Anjan Kant
  • 4,090
  • 41
  • 39
1

In my case, this was the solution.

I found out that I could connect using localhost**instancename**

So I uninstalled Database Engine component only.

Then I ran SQL Server installer and this time chose default instance option whereas before I had named the instance the same as my machine.

Now I can connect using localhost(which is setup in several application config files so I needed to still connect like this).

msteel9999
  • 305
  • 2
  • 15
1

In my case, first I'm inserting/viewing/deleting data in my local SQL Server. Then at some point in development, the client wants to up the system(Windows Forms) in the server (network) so I've face to this kind of problem, what I check is the likes of this.viewEmployeeTableAdapter i delete that because it is still connected to the local db. I notice that because in my PC. The system is working properly whilst when im transferring it to other PC the

Provider named pipes provider error 40 could not open a connection to SQL Server error

is appearing. So it's because I have a sql connection opening MY SQL Server while the other PC doesnt have.

Fiendcoder1
  • 119
  • 1
  • 1
  • 12
0

This error has caused been popping up for me since installing .net 4.7 I had to alter my connection string to include TransparentNetworkIPResolution=False;

Server=server;Database=dbname;Uid=user;Pwd=pword;TransparentNetworkIPResolution=False;
Niederee
  • 4,155
  • 25
  • 38
-2

Best idea is uninstall SQL and again Install SQL, Clear all temp files first and restart after that install. give a proper name to instance at a time of install.