3
votes

I get the following error with SQLClient, are there more error numbers than Error Number: -1, 53, 2?

Error Number: -1, Level: 20, State: 0, Line: 0; 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)

Error Number: 53, Level: 20, State: 0, Line: 0; 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)

Error Number: 2, Level: 20, State: 0, Line: 0; 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)

2
Please try following link for details of errors technet.microsoft.com/en-us/library/cc645611(v=sql.105).aspx The error codes are returned by the db server to the sql slient.G J
Thanks Gaurav Singh Jantwal, this is what I was looking for. Now how do I mark this questions answered?, is it because yours appear as a comment and not as an answer?datadev

2 Answers

0
votes

Please try following link for details of errors

http://technet.microsoft.com/en-us/library/cc645611(v=sql.105).aspx

The error codes are returned by the db server to the sql client.

1
votes

The rules I use for general classification:

  • Number = -1 OR Class/Level/Severity = 20: "Connection Error"

  • Number = -2: "Command Timeout Error"

I believe the negative values are strictly from the client library (ie. network connection issues); this implies the "duplicate" numbers like 2 and 53 come back from the server itself for half-connections.

Other errors (eg. deadlocks/1205) can be more readily defined by the Number.


As the other answer contains, here is also a link to various references: