Solved

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

Posted on 2009-05-18
14
351 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
Comment Utility
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
Comment Utility
do i have to run this command from any machine?
0
 

Author Comment

by:COHFL
Comment Utility
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
 
LVL 57

Expert Comment

by:Raja Jegan R
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
ok this settings are right. Nothing need it to be modified here.
Any other ideas?
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

Author Comment

by:COHFL
Comment Utility
Is there anything else i can try?
Thanks
0
 
LVL 57

Expert Comment

by:Raja Jegan R
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
yes i can connect from another SQL server
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
Comment Utility
<< 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now