[Last Call] Learn how to a build a cloud-first strategyRegister Now


Named Pipes Provider, error: 40 - Could not open a connection to SQL Serve

Posted on 2008-11-10
Medium Priority
Last Modified: 2012-05-05
I have a new application that is connecting to SQL 2005. Every time I run I get the following error:
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)

Application is Vb.net running on an XP box. SQL 2005 is developer edition running on the same box.
The funny thing is that if I run a different application and point it to the same database everything works fine. The code that access the database is the same on both applications.
I have never had any problem getting to SQL on any other application. I have verified that the connection string is correct. The new application also referenced Oracle client, so I thought that might be a problem. I remove all references to the Oracle client and the app still fails.

Any help would be appreciated. This has been haunting me for 2 days.
Question by:ndingle
  • 3
  • 2

Accepted Solution

Cedric_D earned 2000 total points
ID: 22921789
Applications can use different connection strings.
Could you compare them? do you use Windows Authetification or provide user/password to connect SQL?

Also, try disable Named Pipes and Enable Shared Memory and TCP/IP.

Author Comment

ID: 22921821
The connection strings are the same in both applications. This has been verified in debugger. I am using SQL authentication for both applications.

I am not sure how to disable named Pipes, but will give it a try.

Author Comment

ID: 22921937
I enabled TCP/IP and shared memory, disabled named Pipes. Still have the problem.

Expert Comment

ID: 22923863
You have Accepted soluton - but still have a problem?

Do you guarantee both connection strings are 100% equal?
Maybe, one use (local) as server, and second PCNAME?

Do you see: (provider: TCP/IP Provider, error: 40 - Could not open a connection to SQL Server)?

Try write "PCNAME,1433"  (this will force to use TCP/IP with specified port)


Author Comment

ID: 22923881
I did not get the Named pipes turned off as I thought. It solved the problem

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

834 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