Solved

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

Posted on 2009-05-18
14
357 Views
Last Modified: 2012-05-07
Good morning all,
I have spend a few days trying to work on this issued but it does not seems to be working. I have search every where online for a possible solution but nothing seems to do the trick.
here is the error i get:
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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: 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)

Now in my effor to cure the error this is what i have done:
1. Enable the TCP/IP protocol using the Surface Area Configuration Utility
2. I also include TCP/IP using cliconfg.exe
3. SQL Server browser is started.
4. SQL Server and SQL Server Browser are not exempted by the firewall because our company does not uses windows firewall on any machine.  

as you can see i have tried almost everything available trough MSDN website. if you experts have any other solution to this i will really appreciate your help.
Thanks,
COHFL

Here is the stack trace if it helps:
[SqlException (0x80131904): 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)]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800131
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
   System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +737554
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +114
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +381
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +357
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +494
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84
   System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197
   System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121
   System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
   System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
   System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83
   System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160
   System.Web.UI.WebControls.Login.AttemptLogin() +105
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

Open in new window

0
Comment
Question by:COHFL
  • 8
  • 6
14 Comments
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24411798
Try this from the command prompt in your machine:

telnet serverip 1433

It should open a blank window, If it doesn't opens then there is some problem with your connectivity between two machines.
0
 

Author Comment

by:COHFL
ID: 24411875
do i have to run this command from any machine?
0
 

Author Comment

by:COHFL
ID: 24411920
ok i did it from a different computer and it opens up the command window and after a few seconds it dissapear. is that what was expected?
1.JPG
2.JPG
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24412044
One small modification
Click Windows --> Run and then type cmd
and then type telnet 10.1.5.135 1433
It should open a blank window, Otherwise there are network issues between your machines.
0
 

Author Comment

by:COHFL
ID: 24412108
by windows you mean start?
I did:
clikc on start
2. typed cmd
3. typed 10.1.5.135 1433
and this is what i get:

3.JPG
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24412203
It opened a blank screen as required.
Hence there is no issues between the network connectivity of both machines.

Check whether Windows Authentication was enabled in that machine

http://kbase.gfi.com/showarticle.asp?id=KBID002804
0
 

Author Comment

by:COHFL
ID: 24412266
ok this settings are right. Nothing need it to be modified here.
Any other ideas?
0
 

Author Comment

by:COHFL
ID: 24416423
Is there anything else i can try?
Thanks
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24417616
What is the Port you have configured in SQL Server Configuration Manager?
Hope TCP / IP dynamic ports are set to blank and TCP/IP port was set correctly.

If so you have use that port in your connection string, Otherwise it may fail.
Kindly confirm about the Settings in SQL Server Configuration Manager.
0
 

Author Comment

by:COHFL
ID: 24420982
the port configured is the one SQL configures by default i check it and is not been block. That part works!

here is the connection string:
      <connectionStrings>
    <add name="JuvenileConnectionString" connectionString="Data Source=ITPROD;Initial Catalog=JuvenileArrest;User ID=Juvenile;Password=arrest" providerName="System.Data.SqlClient"/>
    <add name="JuvenileArrestConnectionString1" connectionString="Data Source=ITPROD;Initial Catalog=JuvenileArrest;Integrated Security=True;MultipleActiveResultSets=False;Packet Size=4096;Application Name=&quot;Microsoft SQL Server Management Studio&quot;" providerName="System.Data.SqlClient"/>
      </connectionStrings>
0
 

Author Comment

by:COHFL
ID: 24421716
i just try this:
<!--<add name="JuvenileConnectionString" connectionString="Provider=SQLNCLI;Server=10.1.5.135,1433;Database=JuvenileArrest;Trusted_Connection=yes;"/>
still does not work
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24422275
Not sure about Front end as I am not familiar in that one anyhow all possible connection strings for SQL Server 2005 available here:

http://www.connectionstrings.com/sql-server-2005

Can you confirm one more thing, Are you able to connect this server from another SQL Server within the network.
0
 

Author Comment

by:COHFL
ID: 24422455
yes i can connect from another SQL server
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 24422517
<< yes i can connect from another SQL server >>

If that is the case, then there is no problem with your SQL Server.
Its a problem with your connection string or from your application call to database.

Are you trying to connect the default instance or Named Instance of SQL Server ?
If Default Instance, Server name or IP would suffice
If it is named instance, then server name\instancename or IP\instancename is required.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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