A network-related or instance-specific error occurred while establishing a connection to SQL Server

  • Hi,

    The below error is logged into application logs intermittently.But, when I review SQL Server errorlog, event viewer application log, system log on sql server side, there are no errors or warnings at the time the application is getting the error

    Exception: A network-related or instance-specific error occurred while establishing a connection to SQL Server.

    The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

    (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    Please advise how to diagnose this error?

  • when you say its intermittent, is that from the same machine to the same server sometimes it will connect sometimes it wont and nothing changes in the server or app configuration? If thats the case i would guess there is a network issue. when it happens you can try to ping the server hosting the SQL instance and if the ping times out we have our culprit.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • hi

    need to enble tcp/ip

  • Last year our application was throwing this error when we knew for a fact the SQL server WAS up & online. We eventually traced it to a configuration in the application for a different SQL instance which no longer existed. Though we didn't use the feature the configuration was for, we had tested it, and it turned out that if the connection string is filled out the application did test the connection.

    Look through the apps configuration area, config files if they exist and registry. Look for the string "ConnectionString."

    This troubleshooting would be easier if Microsoft included the name if the instance it is unable to connect to in this error (hint hint).

  • hi

    the simple we have do is to enable the tcp /ip property in configuration

    http://www.aspdotnet-sharepoint.com/2012/04/network-related-or-instance-specific.html

  • hi

    we need enable tcp/ip property in sql server configuration manager

    please refer this link

    http://www.aspdotnet-sharepoint.com/2012/04/network-related-or-instance-specific.html

    thanks,

    bhaskar

  • I know this is an old thread but figured I would post here instead of creating a new one. I too am having this issue. The odd thing is I get the error when I try to connect to the SQL Server using .NET code( VB.NET or C#). However, I tried using VB6 and it connects to the DB just fine and pulls the data(using the EXACT same connection string).

    Remote connections is enabled, TCP/IP and naming pipes are enabled, I added both the TCP port 1433 and UDP port 1434 enabled in windows firewall and remote connections is enabled, I'm able to ping the IP of the server as well. I just find it really really odd that I can connect via a VB6 app but not a .NET app. Does anyone have any other ideas what I can try?

  • Patrick Hill-489170 (1/16/2013)


    I know this is an old thread but figured I would post here instead of creating a new one. I too am having this issue. The odd thing is I get the error when I try to connect to the SQL Server using .NET code( VB.NET or C#). However, I tried using VB6 and it connects to the DB just fine and pulls the data(using the EXACT same connection string).

    Remote connections is enabled, TCP/IP and naming pipes are enabled, I added both the TCP port 1433 and UDP port 1434 enabled in windows firewall and remote connections is enabled, I'm able to ping the IP of the server as well. I just find it really really odd that I can connect via a VB6 app but not a .NET app. Does anyone have any other ideas what I can try?

    Using the EXACT same string in VB6 and .NET is probably the issue. It is very likely you don't want the same string because it is likely you are not making the same type of connection. Check out http://www.connectionstrings.com/[/url]

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (1/16/2013)


    Patrick Hill-489170 (1/16/2013)


    I know this is an old thread but figured I would post here instead of creating a new one. I too am having this issue. The odd thing is I get the error when I try to connect to the SQL Server using .NET code( VB.NET or C#). However, I tried using VB6 and it connects to the DB just fine and pulls the data(using the EXACT same connection string).

    Remote connections is enabled, TCP/IP and naming pipes are enabled, I added both the TCP port 1433 and UDP port 1434 enabled in windows firewall and remote connections is enabled, I'm able to ping the IP of the server as well. I just find it really really odd that I can connect via a VB6 app but not a .NET app. Does anyone have any other ideas what I can try?

    Using the EXACT same string in VB6 and .NET is probably the issue. It is very likely you don't want the same string because it is likely you are not making the same type of connection. Check out http://www.connectionstrings.com/[/url]

    I checked connectionstrings.com this is the connection string I'm using:

    Server=Servername\InstanceName;Database=FireSaftey_Test;User Id=fs_admin;

    Password=****;

  • Patrick Hill-489170 (1/17/2013)


    Sean Lange (1/16/2013)


    Patrick Hill-489170 (1/16/2013)


    I know this is an old thread but figured I would post here instead of creating a new one. I too am having this issue. The odd thing is I get the error when I try to connect to the SQL Server using .NET code( VB.NET or C#). However, I tried using VB6 and it connects to the DB just fine and pulls the data(using the EXACT same connection string).

    Remote connections is enabled, TCP/IP and naming pipes are enabled, I added both the TCP port 1433 and UDP port 1434 enabled in windows firewall and remote connections is enabled, I'm able to ping the IP of the server as well. I just find it really really odd that I can connect via a VB6 app but not a .NET app. Does anyone have any other ideas what I can try?

    Using the EXACT same string in VB6 and .NET is probably the issue. It is very likely you don't want the same string because it is likely you are not making the same type of connection. Check out http://www.connectionstrings.com/[/url]

    I checked connectionstrings.com this is the connection string I'm using:

    Server=Servername\InstanceName;Database=FireSaftey_Test;User Id=fs_admin;

    Password=****;

    So you said you can't connect. What is the actual message?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (1/17/2013)


    Patrick Hill-489170 (1/17/2013)


    Sean Lange (1/16/2013)


    Patrick Hill-489170 (1/16/2013)


    I know this is an old thread but figured I would post here instead of creating a new one. I too am having this issue. The odd thing is I get the error when I try to connect to the SQL Server using .NET code( VB.NET or C#). However, I tried using VB6 and it connects to the DB just fine and pulls the data(using the EXACT same connection string).

    Remote connections is enabled, TCP/IP and naming pipes are enabled, I added both the TCP port 1433 and UDP port 1434 enabled in windows firewall and remote connections is enabled, I'm able to ping the IP of the server as well. I just find it really really odd that I can connect via a VB6 app but not a .NET app. Does anyone have any other ideas what I can try?

    Using the EXACT same string in VB6 and .NET is probably the issue. It is very likely you don't want the same string because it is likely you are not making the same type of connection. Check out http://www.connectionstrings.com/[/url]

    I checked connectionstrings.com this is the connection string I'm using:

    Server=Servername\InstanceName;Database=FireSaftey_Test;User Id=fs_admin;

    Password=****;

    So you said you can't connect. What is the actual message?

    "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

    I can connect with VB 6, I can connect when I open up management studio and connect to the server. I can even create a .udl file and connect that way. I just can't get it to connect using .net

    VB 6 code that connects:

    cn.Provider = "sqloledb"

    provStr = "Server=SSQLDBAT014001\RLSOLUTIONS;Database=FireSafety_Test;User Id=fs_admin;Password=******"

    cn.Open provStr

    VB.Net Code that gives me that error:

    Imports System.Data.SqlClient

    Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    Dim cn As New SqlConnection

    cn.ConnectionString = "Server=SSQLDBAT014001\RLSOLUTIONS;Database=FireSafety_Test;User Id=fs_admin;Password=******"

    cn.Open()

  • Hi All,

    We are also getting same error message in production server intermittently.

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode><faultstring xml:lang="en-US">A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</Message><StackTrace> at TPUSA.PWASolution.PSIExtension.ExceptionHandlingWCF.LogEvent(String errorMsg, String eventTrace, String eventType, DateTime Logdate)

    at TPUSA.PWASolution.PSIExtension.ProjectTaskData.GetAllTasksData()

    at SyncInvokeGetAllTasksData(Object , Object[] , Object[] )

    at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)

    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)

    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)

    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.Data.SqlClient.SqlException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>

    Please help me to reslove this error.

  • sivarao.n (8/5/2014)


    Hi All,

    We are also getting same error message in production server intermittently.

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode><faultstring xml:lang="en-US">A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</Message><StackTrace> at TPUSA.PWASolution.PSIExtension.ExceptionHandlingWCF.LogEvent(String errorMsg, String eventTrace, String eventType, DateTime Logdate)

    at TPUSA.PWASolution.PSIExtension.ProjectTaskData.GetAllTasksData()

    at SyncInvokeGetAllTasksData(Object , Object[] , Object[] )

    at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)

    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)

    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)

    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.Data.SqlClient.SqlException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>

    Please help me to reslove this error.

    Intermittent suggests a network issue. Maybe the server goes offline or you have some other kind of network issues. If the same code connects sometimes but not others that is almost always the case.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Having the same problems as described above. I have already:

    Enabled TCP/IP

    Added Exception to the Firewall / disabled Firewall to see if it helps

    Checked if the server is up and running - it is.

    See below screenshots:

    It's my first time with SQL - just following the book and I'm stuck on one of the first pages (600 more to go!)

  • Your connection String should be Like

    "Data Source=ServerName\ServerInstance;Initial Catalog=DatabaseName;user id=userID; password=password;"

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic. Login to reply