SQLState = 08001, NativeError = 53
Error = [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider:
Could not open a connection to SQL Server [53].
SQLState = 08001, NativeError = 53
Error = [Microsoft][ODBC Driver 11 for SQL Server]A network-related or
instance-specific error has occurred while establishing a connection to SQL Server.
Server is not found or not accessible. Check if instance name is correct and
if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
SQLState = S1T00, NativeError = 0
Error = [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired
This is a error I got when my program was trying to connect to a SQL Server 2012 using named pipe.
I Googled a little and found the below article and followed it very carefully and still I got the error.
https://www.mssqltips.com/sqlservertip/2340/resolving-could-not-open-a-connection-to-sql-server-errors/
After further digging, I found that my SQL Server is in a different active directory.
Example: SQLS.domain1.com (IP: 10.8.2.204)
and my client is in another active directory.
Example: client.domain2.com (10.100.2.35)
When I added the host entry, I did it in the right way with a fully qualified name.
But it didn't work because named pipes are used within the same subnet.
So, I did a small trick - I added the following host entry also.
So it will see the machine using machine name though it is in a different domain.
But this worked.