One of the more visible changes we made in connectivity space for SQL Server 2005 was enhancing error messages reported to the user in case of connection failures. I have seen several cases over the last several months, and in this post I would like to list some of them with the root cause that caused them. The cause may not be the only one triggering a particular error message, and there may be other error messages of interest.
This is a semi-random selection from real cases I investigated. Likely I will post another batch some time in the future, and I would be happy to see replies with additional errors, particularly if the root cause is unclear.
The examples are from various client stacks – ODBC or OLEDB from SQL Native Client or from managed SqlClient.
The exact formatting of the messages will depend on the application you use. Most of the examples below used OSQL, SQLCMD, or SQL Server Management Studio.
- Connecting to a server by the server’s name from SqlClient, the server name is aliased to TCP, the server is up and running but it does not listen on TCP (or is not running at all):
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)
- Local connection from SqlClient; server is not running:
(a) default instance:
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) (Microsoft SQL Server, Error: 2)
(b) named instance:
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: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)
- Remote connection from ODBC, Windows Firewall is turned on on the server machine but there is an exception for File and Printer Sharing:
[SQL Native Client]Unable to complete login process due to delay in opening server connection
- A successful TCP connection from SqlClient to the server was broken due to a TCP keep-alive heartbeat failure (typically indicating problems with the underlying network infrastructure):
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)
Possibly:
A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
- OBDC connection attempt when server is not ready to process a new local connection, possibly due to overload:
[SQL Native Client]Shared Memory Provider: Timeout error [258].
[SQL Native Client]Login timeout expired
[SQL Native Client]Unable to complete login process due to delay in prelogin response
[SQL Native Client]Shared Memory Provider: Could not open a connection to SQL Server [121].
[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.
- There is a space after server name in the connection string:
osql -E -S "
Login failed for user ''. The user is not associated with a trusted SQL Server connection.
The server ERRORLOG/EventLog shows something similar to:
2005-08-11 12:46:04.29 Logon Error: 17806, Severity: 20, State: 2.
2005-08-11 12:46:04.29 Logon SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed. [CLIENT:
2005-08-11 12:46:04.29 Logon Error: 18452, Severity: 14, State: 1.
2005-08-11 12:46:04.29 Logon Login failed for user ''. The user is not associated with a trusted SQL Server connection. [CLIENT:
- Remote OLEDB connection using TCP to a server that is blocked by Firewall
HResult 0x274C, Level 16, State 1
TCP Provider: 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.
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.
- Remote OLEDB connection using TCP to a server that is either not running or does not have TCP/IP protocol enabled for incoming connections (but is not blocked by the Firewall on the server machine):
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.
No comments:
Post a Comment