Solved

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

Posted on 2009-05-18
14
355 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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