SQL Server 2005 Connectivity Issue Troubleshoot - Part I

SQL Server 2005 Connectivity Issue Troubleshoot - Part I

Rate This

This post provides some tips to troubleshoot Sql Server connection problems based on various displayed error messages. And, I will describe connection problems according to different client stack: SNAC/MDAC/SQLClient. Thus, there are 3 parts for this topic.

 

First Part – Troubleshoot SNAC connect to SQL Server 2005

Second Part - Troubleshoot MDAC connect to SQL Server 2005

Third Part – Troubleshoot SqlClient connect to SQL Server 2005

 

Before start, it is very important to identify which client connected to Server and failed. Here, I list out follow key terminology in Sql Server Connection.

 

SNAC - A new data access technology that is new in SQL Server 2005, and is a stand alone data access application programming interface that is used for both ODBC and OLEDB.

 

MDAC - Microsoft Data Access Component contains core data access components, such as OLEDB provider and ODBC provider.

 

SqlClient  - Access data from within a CLR database object by using the .NET Framework Data Provider for SQL Server.

 

Protocol Prefix: explicitly specify which protocol you want to use to make connection. Supported protocol prefix in Sql Server 2005 includes: “lpc:”, “np:”, “tcp:”, “via:”

 

Last connect cache – contains the fully resolved/specified connection strings for the instances that were successfully connected to. 

 

Part I – Connection Fail when SNAC connects to Sql Server 2005

 

Use osql.exe to simulate the connection string in your application and quick troubleshoot if your application uses ODBC provider and use sqlcmd.exe for OLEDB provider. They are located in %SYSTEMDRIVE%\Program Files\Microsoft Sql Server\90\tools\binn.

 

Basic connection string:          osql(sqlcmd) /S[prefix]<servername> /E

                                                Osql(sqlcmd) /S[prefix]<servername>\<Instance> /E

In each follow Message, there are two, one is from ODBC, and the other one is from OLEDB.

 

Message 1:

 

[SQL Native Client]Named Pipes Provider: Could not open a connection to SQL Server [53].
[SQL Native Client]Login timeout expired
[SQL Native Client]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.


-OR-

 

HResult 0x35, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [53].
Error: Microsoft SQL Native Client : 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..

Error: Microsoft SQL Native Client : Login timeout expired.

 

This indicates that your target server can not be accessed or does not exist. Try to use "ping <servername>" , " ping <ipofserver>" , "ping -a <ip>", If either of the pings time out, fail, or do not return the correct values, then either the DNS lookup is not working properly or there is some other networking or routing issue that you will need to resolve.

 

Message 2:

 

[SQL Native Client]Named Pipes Provider: Could not open a connection to SQL

Server [2].

[SQL Native Client]Login timeout expired

[SQL Native Client]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.

 

-OR-

 

HResult 0x2, Level 16, State 1

Named Pipes Provider: Could not open a connection to SQL Server [2].

Error: Microsoft SQL Native Client : 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..

Error: Microsoft SQL Native Client : Login timeout expired.

 

This error message means that the server was not found or not running or can not make Named Pipe connection through the pipe name that client specified. To verify this:

 

1) From the command line, do "sc query mssqlserver" or "sc query mssql$<instancename>" to check whether sql instance present.  Then open sql server configuration manager -> check the state of the sql service, if it is not running, start it. If server started fail, check event log or server error log, see what happened there.

2)  if you are sure the service is running and shared memory/Named Pipe enabled, please try connection if it is local default instance "osql /Snp:\\.\pipe\sql\query"; or try connection "osql /Snp:\\.\pipe\mssql$<InstanceName>\sql\query" if it is local named instance. if you still get error 2, then go to step 3).

3) Double check the server is started and listening on named pipe if you enabled Named Pipe. One way is that see the ERRORLOG of the server, search follow keywords: 

Server named pipe provider is ready to accept connection on [ \\.\pipe\sql\query ] or [\\.\pipe\mssql$<InstanceName>\sql\query] 

Notice that "sql\query" is the default pipe name, so you need to know server is listening on which pipe name. eg: if you specify server pipe name is "sql\query1", then you would see in the errorlog that server listening on [ \\.\pipe\sql\query1 ]. 

4) See your connection string, whether you explicitly specify the pipe name and does it match the pipe that server is listening on? Or whether you just specify server name( like ".","(local)", etc), but you specify the wrong pipe name on client side Named Pipe configuration.eg, go to SQL Server Configuration Manager, click client Named Pipe properties, see whether the pipe name is same with the one server listening on. 

Note: For remote connection, you need to verify step 2) and 3).  

Message 3:

 

[SQL Native Client]Named Pipes Provider: Could not open a connection to SQL

Server [233].

[SQL Native Client]Login timeout expired

[SQL Native Client]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.

 

 -OR-

 

HResult 0xE9, Level 16, State 1

Named Pipes Provider: Could not open a connection to SQL Server [233].

Error: Microsoft SQL Native Client : 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..

Error: Microsoft SQL Native Client : Login timeout expired.

 

Note: the difference between Message 2 and Message 1 is “Could not open a connection to SQL Server [233].” – error state.

 

You might specify the server name as FQDN/127.0.0.1/ IP Address and NP was disabled on the server. To resolve this, first way is to replace server name as the machine name or “.” or”(local)” or “<machinename>” and you should be able to connect as long as server listening on Shared Memory; second way is to enable named pipe from sql configuration manager and restart server.

 

Message 4:

 

[SQL Native Client]Named Pipes Provider: No process is on the other end of the pipe.

[SQL Native Client]Communication link failure

[SQL Native Client]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.

 

-OR-

 

HResult 0xE9, Level 16, State 1

Named Pipes Provider: No process is on the other end of the pipe.

Error: Microsoft SQL Native Client : Communication link failure.

Error: Microsoft SQL Native Client : 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..

 

1) Local connection: You might specify the server name as FQDN/127.0.0.1/ IP Address in the connection string and speculate connection through Named Pipe provider. To resolve this, either change server name to <machinename> as long as the server is listening on Shared Memory or enabled NP.

2) Remote connection: the server is not listening on Name Pipe. To resolve this, enable name pipe on the remote server and restart the server.

 

Message 5:

 

[SQL Native Client]SQL Network Interfaces: Server doesn't support requested protocol [xFFFFFFFF].

[SQL Native Client]Login timeout expired

[SQL Native Client]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.

 

-OR-

 

HResult 0xFFFFFFFF, Level 16, State 1

SQL Network Interfaces: Server doesn't support requested protocol [xFFFFFFFF].

Error: Microsoft SQL Native Client : 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..

Error: Microsoft SQL Native Client : Login timeout expired.

 

1)     Local connection: You might explicitly specify protocol prefix “np:” and connect to a named instance and NP was disabled.

2)     Remote connection: You might connect to remote named instance and remote server is not listening on name pipe.

To resolve this, enable NP if you only want to use name pipe protocol or you can remove “np:” prefix to let connection over shared memory locally.

 

Message 6:

 

[SQL Native Client]SQL Network Interfaces: Error Locating Server/Instance Specified [0xFFFFFFFF].

[SQL Native Client]Login timeout expired

[SQL Native Client]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 remot the connections.

 

-OR-

 

HResult 0xFFFFFFFF, Level 16, State 1
SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].

Error: Microsoft SQL Native Client : 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..

Error: Microsoft SQL Native Client : Login timeout expired.

 

You might connect to local named instance and explicitly specify protocol prefix “tcp:” or “np:” in the connection string, however, SqlBrowser service was not running.

To resolve this, you should enable Sqlbrowser service on the server

1)     Use net start or go to sql configuration manager(SSCM), check whether sqlbrowser service is running, if not, start it.

2)     You still need to make sure SqlBrowser is active. Go to SSCM, click properties of sqlbrowser service -> Advanced-> Active “Yes” or “No”, if sqlbrowser is running but is not active, the service would not serve you correct pipe name and Tcp port info on which your connection depends.

 

Message 7: Shared Memory provider error

 

HResult 0x2, Level 16, State 1

Shared Memory Provider: Could not open a connection to SQL Server [2].

Error: Microsoft SQL Native Client : 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..

Error: Microsoft SQL Native Client : Login timeout expired.

 

-OR- 

 

[SQL Native Client]Shared Memory Provider: Could not open a connection to SQLServer [2].

[SQL Native Client]Login timeout expired

[SQL Native Client]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.

The error indicate you speculated shared memory as connection protocol and server is not listening on shared memory, plus you probably specified “.”/”(local)”/<machinename> /localhost as the server name in the connection string. To resolve this, enable shared memory protocol and restart the server.

 

Message 8:

 

[SQL Native Client]SQL Network Interfaces: Cannot open a Shared Memory connection to a remote SQL server [87].

[SQL Native Client]Login timeout expired

[SQL Native Client]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.

 

-OR-

 

HResult 0x57, Level 16, State 1

SQL Network Interfaces: Cannot open a Shared Memory connection to a remote SQL server [87].

Error: Microsoft SQL Native Client : 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..

Error: Microsoft SQL Native Client : Login timeout expired.

The reason is same as the one of Message 6, just you might specify FQDN/127.0.0.1/IP Address as server name in the connection string.

 

Message 9: TCP specific

 

[SQL Native Client]TCP Provider: No connection could be made because the target machine actively refused it.

[SQL Native Client]Login timeout expired

[SQL Native Client]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.

 

-OR-

 

HResult 0x274D, Level 16, State 1

TCP Provider: No connection could be made because the target machine actively refused it.

Error: Microsoft SQL Native Client : 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..

Error: Microsoft SQL Native Client : Login timeout expired.

 

The reason is server is not listening on TCP, probably TCP protocol was not enabled.

 

-Follow messages are some special case - 

 

Message 10:

 

[SQL Native Client]Unable to complete login process due to delay in opening server connection.

 

Reason:

1)     There are spaces after Instance name in the connection string eg. osql /S”<machinename>\Instance  “ /E, to resolve this, you need to remove the trailing space.

2)     Connect through 127.0.01.

3)     Remote connection and WINS was disabled on the client machine and you connect using FQDN as server name. To resolve this, One way, turn on “File and Printer Sharing” and explicitly use name pipe protocol. Another is enlarge the connect timeout to around 30 secondes.

 

Message 11: - Firewall specific

 

HResult 0x274C, Level 16, State 1
An error has occurred while establishing a connection to the server. When connectiong 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:TCP Provider, errror:0-A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)

 

-OR-

 

Error: Microsoft SQL Native Client : 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..
Error: Microsoft SQL Native Client : Login timeout expired.

 

This is because connection blocked by firewall. To resolve this, take follow steps:

1)     Enable SqlBrowser, see the info in Message 4. Plus, add sqlbrowser.exe into Firewall exception list: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\AuthorizedApplications\List
2)     Add Tcp port to Firewall exception list. (eg, Name-1433:TCP, Value-1433:TCP:*:Enabled:Tcp 1433).

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\GloballyOpenPorts\List

For more detailed  operation, see http://support.microsoft.com/default.aspx?scid=kb;en-us;287932 

 

Message 12:

 

“[SQL Native Client] Can not Generate SSPI Message”

 

http://blogs.msdn.com/sql_protocols/archive/2005/10/19/482782.aspx 

 

Part II - Troubleshoot Connectivity Issue in SQL Server 2005

 

http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx

 

Part III - Troubleshoot Connectivity Issue in SQL Server 2005

 

http://blogs.msdn.com/sql_protocols/archive/2005/12/22/506607.aspx

 

 

Ming Lu SQL Server Protocols

Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights

Leave a Comment
  • Please add 8 and 1 and type the answer here:
  • Post
  • TITLE: SQL Server Import and Export Wizard

    ------------------------------

    Could not set up data flow connections.

    The connection type "OLEDB" specified for connection manager "{2674C80A-233C-4394-A978-EE8B07D623A8}" is not recognized as a valid connection manager type. This error is returned when an attempt is made to create a connection manager for an unknown connection type. Check the spelling in the connection type name.

    ------------------------------

    ADDITIONAL INFORMATION:

    The connection type "OLEDB" specified for connection manager "{2674C80A-233C-4394-A978-EE8B07D623A8}" is not recognized as a valid connection manager type. This error is returned when an attempt is made to create a connection manager for an unknown connection type. Check the spelling in the connection type name.

    ({472FD15D-0A3F-440F-9CA7-53F399921BF0})

    ------------------------------

    BUTTONS:

    OK

    ------------------------------

    TITLE: SQL Server Import and Export Wizard

    ------------------------------

    Could not connect source component.

    The connection "SourceConnectionOLEDB" is not found. This error is thrown by Connections collection when the specific connection element is not found.

    ------------------------------

    ADDITIONAL INFORMATION:

    The connection "SourceConnectionOLEDB" is not found. This error is thrown by Connections collection when the specific connection element is not found.

    ({472FD15D-0A3F-440F-9CA7-53F399921BF0})

    ------------------------------

    BUTTONS:

    OK

    ------------------------------

  • hello sir,

    i m having problem...problems i must say in connection to MS sql server 2005.

    1) I works fine with windows authentication...but does not work with sqlserver authentication.

    2) I program it give error 40...something like that.

    3) Please help me configure sql server fro sqlserver authentication and connection

  • Yo tengo una aplicacion hecha en VB 2005, mi aplicacion la monte en un servidor 2008 con sql 2005, mi aplicacion hace una búsqueda en una base de datos y muestra un GridView mismo que puede paginar la informacion. Puedo ingresar a mi aplicacion (algunos componentes cargan datos de la base de datos), logro hacer la busqueda y el grid view la pagina, el problema es que cuando quiero ver lasiguiente pagina u otra que no sea la primera me manda el error. Puedo ingresar a mi aplicacion (algunos componentes cargan datos de la base de datos), logro hacer la busqueda y el Vista grid la pagina, el problema es que quiero ver cuando lasiguiente pagina u otra que no sea la primera me manda el error.

    "Error mientras se establecía la conexión con el servidor. Al conectar con SQL Server 2005, el error se puede producir porque la configuración predeterminada de SQL Server no admite conexiones remotas. (provider: Proveedor de canalizaciones con nombre, error: 40 - No se pudo abrir una conexión con SQL Server) " "Error mientras se establecía la conexión con el servidor. Al conectar con SQL Server 2005, el error se puede producir porque la configuración predeterminada de SQL Server no admite conexiones remotas. (Proveedor de: proveedor de canalizaciones con nombre, error: 40 - No se pudo abrir una conexión con SQL Server) "

    La opcion de conexiones remotas esta marcada y mi FireWall esta configurado para que permita la conexion, si no fuera asi no me deberia permitir ingresar a mi aplicacion pues mi aplicacion al cargarse utiliza la base de datos. La opcion de conexiones remotas esta marcada y mi firewall está configurado para que permita la conexión, si no fuera asi no me deberia permitir ingresar a mi aplicacion mi aplicacion pues al cargarse utiliza la base de datos.

    espero me puedan ayudar muchas gracias. espero me puedan ayudar muchas gracias.

  • plz tell me about the error 40

    its hapening here when i wants to connect with remote server. and its also tell dat sqlserver doesnot connect with remote server in default setting, is dere any genious who tell me about dis problem

  • Hi,

      I am trying to connect to the SQL Server2005 database through SQlConnection in VS2005 using .NET2.0. It works great for direct internet connections but does not work when the client computer is connected to internet through a proxy server. Any pointers on what I should be doing ?

    Atul

  • Hello,

    I am running SQL 2005 Server management studio. I can connect remotely to other DB's in the domain where the SQL server is located without any problems.

    The problem I have is when I try to connect to a DB in another domain I get the following error message: "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Also, I've tried connecting via the osql prompt but I get the same error.

    There are other SQL 2005 servers in the domain that are workking fine. It's only this one server that is causing this problem.

    Thanks for your help!

  • why oh why did i ever decide to 'get into computers'

  • I keep getting this error....

    Connection failed:

    SQLState:'01000'

    SQL  Server Error:2

    [Microsoft][ODBC SQL Servier Driver][DBNETLIB]Connection Open

    (Connect()).

    SQL State:'08001'

    SQL Server Error:17

    [Microsoft]{ODBC SQL Server Driver][DBNEBLIB]SQL Server does not exist or access denied.

    but your instructions will not work for Windows Vista. I am just a baby when it comes to this stuff. Please Help

  • I tried to establish a remote connectivity with another instance of sql server 2005 in a remote computer and inspite of following all the steps,I coudn't make it and i got the following error:

    "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)

    (.Net SqlClient Data Provider) "

    Please write down step by step procedure to resolve this issue.

    Thankyou

  • use the connection string in this way and if you follow all the instructions that the users give before maybe you can solve the problem...

    static SqlConnection cn = new SqlConnection("Server=YOURPC\\SQLEXPRESS; Database=YOURBASE; Trusted_Connection=true");

  • In Message 3, you indicate that error 233 is related to "Could not open a connection to SQL Server"

    How is it that sysmessages shows error 233 as "The column '%.*ls' in table '%.*ls' cannot be null."?

  • [Hi,

     I am trying to connect to the SQL Server2005 database through SQlConnection in VS2005 using .NET2.0. It works great for direct internet connections but does not work when the client computer is connected to internet through a proxy server. Any pointers on what I should be doing ?]

    Somebody asked this... can we find an answer?

  • Thank you very much for your post you have solved my gr8 problem.

  • I am using the connection string in the following  way but i couldnot overcome of (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) problem, even i declared impersonate="true" in config file

    static SqlConnection cn = new SqlConnection("Server=YOURPC\\SQLEXPRESS; Database=YOURBASE; Trusted_Connection=true");

  • Hi guys,

    I work as a DBA and i configured replication from server A to B. but iam geting an error 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: TCP Provider, error: 0 – No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061).

    snapshot agent is running on server A but server A is not able to connect to server B

    when i check in replication monitor ican see the error can connect to server and the above error…can anyone help me on this issue..iam working on it since 2 ddays but no luck.

    iam able to ping server B from server A using 1433 port. even tcp/ip is enabled on both servers and there is no windows firewall enabled on server B. i even enabled sql server browser. i dont understand what is the issue.

Page 9 of 10 (142 items) «678910