Troubleshoot SQL Server Connection
Cannot Connect to SQL Server
Sometimes after you install/setup SQL Server and trying to connect to the server you might face this problem:
A network-related or instance-specific error occured while establishing a connection to SQL Server. The server was not found or was not accessible.
This is a very common problem that often occurs and it is related to the user trying to connect to the SQL Server but cannot find the server or it is not accessible from the user's current connection.
So on this docs I will show you how to troubleshoot this problem:
1. Check the Instance Name or IP Address
Before we proceed further, make sure that you typed the correct SQL Server instance name or IP Address which you are trying to connect to. If it's a typo then everything should just be fine after you input the right name or IP Address
2. Check SQL Server Protocol and Port
Go to the Server which host the SQL Server instance, and then go to SQL Server Configuration Manager. Make sure the protocol of TCP/IP is enabled, and also check for the port if it's using a custom port or default 1433. If you are using a custom port then make sure to connect using the proper connection string, which is <instance name>, <port> (example: SQL02\SQL02, 1433)
3. Check the Network Firewall and Network Connectivity
This is usually the main reason your connection cannot reach SQL Server, because there is firewall that blocks the connection. So you need to allow inbound and outbound rules for Port that the SQL Server is using (default is 1433). Add a rule to inbound and outbound rule to allow TCP connection to the server or if you host the SQL Server at Cloud, then make sure you make the firewall allow TCP connection for your SQL Server port (default: 1433). If your server doesn't need the security function of firewall (because maybe it's already isolated enough) then you can just disable firewall for the server so it won't be blocking incoming connection.
After you setting your firewall then you also need to check if your server can be reached via network from the user's network. For example, the user might be using different IP Network Segment like 12.0.0.10 while your server are hosted at IP Network Segment 10.0.0.10. For this, you also need to test if it's reachable from user's connection or not, try to Ping the Server.
To test connectivity to a specific port, you need to use Telnet (if you haven't installed it yet, install Telnet Client from Server Manager Features). Using telnet, you need to make sure that it's not resulting in an error, if telnet successfully connect it will result in blank page of the CMD. If it's error then you need to check the firewall rules in the server to allow connection for the port.
4. Check the SQL Server Service if it's Running and Enable SQL Server Browser
Check in your server and make sure that SQL Server service is running. If you are still getting connection error then try to enable SQL Server Browser Service. Go to the SQL Server Configuration Management and then select the SQL Server Browser Service, enable the service. After that try to connect again to the SQL Server.
5. Allow Remote Connection Configuration in SQL Server
This might be hardly ever the cause, but if you still cannot connect you should check inside the SQL Server from the local SSMS login to the SQL instance and see the connection properties of the Server. Make sure that the option Allow remote connections to this server are checked. This is by default will be enabled every time SQL Server is installed hence it usually is not the issue.
Comments
Post a Comment