• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2282
  • Last Modified:

Cannot connect to database. Providor Named Pipes Providor: 40

I get this error when I try and log into my SQL Server 2005 database:
"An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider)"

It was working fine two days ago...I'm pretty new to this any help would be greatly appreciated!  Thank you!
0
eunuch_provocateur
Asked:
eunuch_provocateur
3 Solutions
 
Aneesh RetnakaranDatabase AdministratorCommented:
1. Open the SQL Server Configuration Manager by clicking Start, All Programs, Microsoft SQL Server 2005, Configuration Tools, SQL Server Configuration Manager.
2. In the left pane of the SQL Server Configuration Manger, expand the node for SQL Server 2005 Network Configuration and select Protocols for SQL.
3. In the right pane, right-click Named Pipes and choose Enable.
4. Right-click TCIP/IP and choose Enable.
5. In the left pane, select SQL Server 2005 Services.
6. In the right pane, right-click SQL Server Browser and choose Properties.
7. Click the Services tab in the Properties dialog box.
8. On the Services page, set the Start Mode property to Automatic and click OK.
9. Right-click SQL Server Browser and choose Start.
10. Right click SQL Server and choose Restart.
0
 
eunuch_provocateurAuthor Commented:
After I do that I get the error:
"The request failed or the service did not respond in a timely fashion.  Consult the event log or other applicable error logs for details."

The thing is that I alredy had those set like you stated in your solution.  I'm wondering if I should just reinstall the SQL server software?  Will that create more problems or let me start from scratch again?  I won' lose much data as I'm just getting started with this...I just want to know the way to do it right.  

Thanks for you help!
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
eunuch_provocateur,
> "The request failed or the service did not respond in a timely fashion.  
> Consult the event log or other applicable error logs for details."
check whether any firewall is installed ? also check the remote service has started in the server ?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
eunuch_provocateurAuthor Commented:
I have a firewall installed but I have it turned off when I try and connect to the database.  I also have exceptions for anything related to SQL Server.  

I'm not sure how to check if the remote service has started in the server.  

Will it be of any user to uninstall SQL Server 2005 and then try and reinstall it?
0
 
eunuch_provocateurAuthor Commented:
Ok, I reinstalled SQL Server and I can connect to the database fine.  

I'm trying to install the sample database 'pubs' but cannot get this to work.  I think the problem is that I'm using the command:  osql.exe -E -S <computername>\<instancename>  -i instpubs.sql

The problem is I'm not sure what to do with the instance name.  Where do I set up the instance...apparantly I can not use just the default.  Any help would be greatly appreciated.  Thank you!

0
 
Aneesh RetnakaranDatabase AdministratorCommented:
Ok that's great..
One way to solve this problem is  to create an alias for this, with server name as 'ServerName\InstanceName'

Then you can use OSQL -E -S uraliaseName 0i
0
 
eunuch_provocateurAuthor Commented:
How do I create an alias?  Sorry for alll the questions...I just don't want to get locked out again for pressing something I shouldn't.  Thanks!
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
0
 
eunuch_provocateurAuthor Commented:
It's not working...I'm now trying set up the surface area to allow remote connections.

Should it be this difficult?
0
 
rmacfadyenCommented:
The instance name is defined during SQL's installation procedure. If you installed SQL 2005 Express using the defaults this will install with an instance name of SQLExpress (so your server "name" is "myserver\sqlexpress"). With regular SQL 2005 (standard edition etc) the installer creates an default instance without a name (so your server name is just "myserver").

Typically to discover what instances are installed you need to use SQL Studio (on the machine where SQL is installed). Its connection dialog will list all the instances in the dropdown.

Regards,

Rob
0
 
lokeshgm7Commented:
You are running into a bug which has been fixed in SP1. the work around is to do the following

If you explicitly specify to the TCP/IP protocol to connect to the instance of SQL Server 2005, you can successfully connect to the instance. For example, you can use the following command to connect the instance:

Osql –E -S tcp:<IPAddress>[\<InstanceName>],<Port>
Note You must make sure that you enable the TCP/IP protocol in SQL Server 2005.  
• Restart the SQL Server 2005 service.  
0
 
eunuch_provocateurAuthor Commented:
I got the solution from this website:   http://www.codinghorror.com/blog/archives/000434.html 

Thank you all for your help!
0

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now