This was originally posted in the SSIS Forum, but a member of the IS team suggested it be moved here. "Most recently I got this error (Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) so does this mean that SQL Server is still trying to use named pipes even if I only have TCP/IP enabled in SQL Server Configuration Manager "
I'm having the same issue, and here's our scenario:
- Installed SQL Server 2005 Developer Edition on a machine with WinXP SP2 and enabled remote connections over TCP/IP
- Installed SQL Server 2005 Standard Edition on a machine with Win2003 SP1 (remote connections over TCP/IP enabled by default)
- Attempted to 'Copy Database' from Developer Edition TO Standard Edition using 'Detach and Attach' method and recieved the error on the Win2003 machine: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
- Attempted to 'Copy Database' from Developer Edition TO Standard Edition using 'SQL Management Objects' method and recieved the error on the Win2003 machine: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
- Reinstalled Standard Edition on the Win2003 SP1 machine
- Checked all the settings on both machines several times, restarted services etc., and read every post I could find referencing the error.
- Same error
- Lost my last hair
Thanks in advance,
Steve

Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
John M 37373737
ChandlerDeng
In general the error:
Named Pipes Provider, error: 40 - Could not open a connection to SQL Server
Is just a basic connectivity error meaning the client could not connect to the target SQL Server. So just follow the basic connectivity troubleshooting guidelines on our SQL Protocols blog, see:
SQL Server 2005 Connectivity Issue Troubleshoot - Part I
http://blogs.msdn.com/sql_protocols/archive/2005/10/22/483684.aspx
and
SQL Server 2005 Connectivity Issue Troubleshoot - Part II
http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx
This should help you debug the problem.
marta_p
Nan,
I'm probably going to thank you for your help every time I post - so again, thanks for your help. I've tried the basic connectivity tests (below is the command line output) and they were successful. I have had no connectivity issues using SQL Studio or otherwise, unless it involves using the 'Copy Database' task and SQL Server Agent.
Has anyone been able to successfully execute a 'Copy Database' from one SQL Server 2005 to another
Steve
VanceMorrison
Nan,
Before I get on with this post - thank you for your reply.
The XPSP2 machine actually had the firewall disabled, and I verified that it could accept connections on the the associated ports with the Shields Up utility. I tested this on both machines.
I can connect to the server from the XPSP2 machine, Import / Export, manage, view logs, and do everything EXCEPT get the Copy Database package to run. SQL Server Agent always fails on the last step with the following error:
Have you (or anyone else) successfully executed a Copy Databse task
Steve
DDB007
From the error message, your scenario is broken on connection stage and I would like to know if you have tried basic connectivity tests between the two mahcines you are working on. One simple way to verifty connectivity is to use command line tools, such as osql.exe. For example, osql -E -Stcp:servername\instancename. If it connects cross-machine successfully, please also verify that your connection string in your scenario is correct.
David_bubu
Blaine
Also -
Windows XP with SP2, Windows Firewall is probably blocking your SQL connection:
http://support.microsoft.com/default.aspx scid=kb;en-us;839269
JReuben
Hi Steve,
I just ran the Copy Database Wizard myself on my SQL Server 2005 and I suspect the problem you are running into is due to the account that SQL Agent runs under. You need to create a SQL Agent Proxy account that can login to the remote machine and then use this account. By default the SQL Agent service account does not have remote access.
When you get to the page thay says: "Schedule the Package" at the bottom you will see the "Integration Services Proxy Account" selection, you need to create an account that can login to the remote machine (standard account is easiest) and then select this account rather than "SQL Server Agent Service Account"
See ->
How to: Create a Proxy (SQL Server Management Studio)http://msdn2.microsoft.com/en-us/library/ms190698.aspx
Matt
TVHuff
The error is reported by client library. While your server is listeing on remote TCP, client will still try TCP and NP connection in order. So the error client behavior is expected. From what you have described, I believe that even though you enabled the remote TCP connection on the XPSP2 machine, you didn't make the TCP listening port an exception of XPSP2 personal firewall. You should follow steps below to resolve this issue.
1. check the SQL Server Errorlog to make sure SQL Server is now listening on TCP/IP and confirm which port it is listening on. Usually 1433. In the Errorlog, you will see several lines that discuss what SQL Server is listening on. Below is an example:
2006-01-04 01:41:07.65 server SQL server listening on 10.254.1.150: 1433. <--Shows the IP Address and the port.
2006-01-04 01:41:07.65 server SQL server listening on 127.0.0.1: 1433. <--Shows another IP Address and the port.
2006-01-04 01:41:07.69 server SQL server listening on TCP, Shared Memory, Named Pipes.
2006-01-04 01:41:07.69 server SQL Server is ready for client connections
2, Make sure on Windows XP that the firewall is not blocking that port.
3, go to your client machine and run the client network configuration tool (cliconfg.exe) Make sure TCP/IP is enabled, click properties and make sure the port number is the same one as SQL Server is listening on. Here you can enable NP or disable client NP as well.
Once both the client and the server are using TCP/IP with the same port number and the firewall on server machines is not blocked, you should be able to connect.
Hope this helps.
rainvt
Thanks for the reply Matt.. I've been off-site working on a different project and will post again as soon as I'm able to implement your suggestion.
Steve
jlandheer
Hi,
I am able to remotely connect to SQL Server 2005 using the Management Studio and also via application running on the client machine.
I am attempting a setup project for dynamically creating database for which I need to connection to the sql server during install. It is at this stage that I get the error - Default settings do not allow remote connections. Whereas on my sql server remote connections using both named pipes as well as tcp / ip are enabled...
PLZ HELP!!
tswaters
Thanks for all the help;)
Also, if this still doesnt fix ur problem , try these tips
- Enable the TCP/IP protocol using the Surface Area Configuration Utility
- Make sure the TCP/IP protocol is enabled in the SQL Server Configuration Utility
- Make sure the SQL Server browser is started. Note this step
is optional. It is possible to set the SQL Server instance to use a fixed IP address - but this is
non-standard for named instances
- Make sure SQL Server and SQL Server Browser are exempted by the firewall on the server machine.
This is done by putting sqlservr.exe and sqlbrowser.exe as an exception in the
windows firewall.
- Note: In order to get things to work. You might need to completely reboot the
server machine after making the changes. There have been reports (thanks P.C.) that starting and stopping the
SQL Server and Browser software is not enough.
resource:www.datamasker.comScript Spider
juan carlos ceresola