Troubleshooting Database Connection Issues
This article lists some reasons why you cannot connect to SQL Server remotely and shows you how to solve the remote database connection issues.
1> SQL Server service is not running.
2> DB user does not have correct password or permission.
3> Firewall restricts IP connection on the “Security” page.
4> Remote Connection issue between your local server to our SQL Server.
5> The SQL Server remote connection port is blocked by your server or ISP.
6> Wrong SQL Server connection information defined in application.
SQL Server service is not running
1) Please check the status on the “Overview” page of your application in the Control Panel.
2)Running the command “ps –ef | grep mssql” via shell interface to check the SQL Server status. The service is working if the result is as the following screenshot shows.
DB user does not have correct password or permission
You can test if the database user and password are correct through Shell/SSH.
Firewall restricts IP connection on the “Security” page
If you have enabled Firewall Rules under the “Security” tab, it will restrict the remote connection. Only the listed IPs will be allowed to connect to your application.
You can add more allowed IPs to the Firewall(a maximum of 5 IPs or IP ranges).
Or you just stop the Firewall service to allow connections from all IPs.
Remote Connection issue between your local server to our SQL Server
We can use “ping” and “tracert” commands on your local computer to test the remote connection.
1. Use Ping to check the connection issue
Get the SQL Server package host IP on the Overview page in the Control Panel.
As our SQL Server do not allow ping function. You can ping the gateway of the SQL Server package on local PC to test the connection between local PC and SQL Server server. If the result is like the following screenshot shows, it is normal. If it shows time out, please check your local network.
2. Use “Tracert” comamnd to check the connection issue
You can use the “tracert” command on most operation system to test the connection.
Mac / Linux:
Please run “yum -y install traceroute” or “apt-get install traceroute” to install traceroute first.
1.Open a Terminal window.
<sql_server_host_ip>" in the terminal and hit enter.
1.Open the Start menu.
2.Click on Run.
3.Type "cmd" and press "OK" to open a command prompt.
<sql_server_host_ip>" and hit enter.
<sql_server_host_ip> should be filled in with your SQL Server hostname or host IP. If the result is like the following screenshot shows, it is normal. If the tracert process cannot complete, please check your local network.
The SQL Server remote connection port is blocked by your server or ISP
We can use telnet command to test if the port is blocked by your server or ISP.
If we want to test if the port 16461 is blocked, we can use “telnet 18.104.22.168 16461” .
If the telnet command cannot be recognized on your local PC, please install a telnet client first.
To install a telnet client,
Centos: # yum -y install telnet
Ubuntu & Debian: # apt-get install telnet
Wrong SQL Server connection information defined in the application
Please refer to the article “Connecting to SQL Server via Different Programming Languages” to check your database connection information in your codes.