When troubleshooting a new environment, it is often helpful to isolate the various components in play and test them in isolation as simply as possible.
For testing connectivity to a database, a simple TCP connection can be made by using the telnet application. The advantage of using telnet is that is extremely simple. There are no configuration files to modify and no authentication. It either makes the connection or does not.
Once you know that the database is accessible, you can move on to testing via applications such as your database’s native client, or Looker.
Some hosts may come with Telnet pre-installed. To test this, try:
You should see something like this:
usage: telnet [-l user] [-a] [-s src_addr] host-name [port]
If you get a “command not found” error you will need to install telnet.
sudo apt-get install telnet
yum install telnet
You will need to know which port your database is running on. The following table lists the default ports for a number of platforms, although your database may be configured to run on a different port. Consult your database administrator.
|Microsoft SQL Server (MSSQL)||1433|
Connecting to Your Database with Telnet
To test the connection to your database, run
telnet hostname port. For example, if you are running MySQL on the default port and your database name is mydb, the command would be
telnet mydb 3306.
If the connection is working, you will see something similar to this:
Trying 10.10.10.10... Connected to mydb. Escape character is '^]'.
If the connection is NOT working, you will see something like one of these:
Trying 10.10.10.10... telnet: Unable to connect to remote host: Connection timed out
Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused
telnet: could not resolve mydb/telnet: Name or service not known
If the telent check is not successful, consider the following:
- Is the hostname correct?
- Are the db and telnet hosts configured to allow the network traffic between them? Check any installed firewall software on both hosts.
- Are all the networks between the telnet and database hosts configured to allow the network traffic? Check firewalls and network Access Control Lists (ACLs).
- Are all the networks between the telnet and database hosts configured correctly to route traffic between the hosts?
- Is the database server running, is it listening on the correct port, and is it configured to allow connections from the telnet server?
If you are able to telnet your your database server’s port you can rule out basic connectivity issues. The next step is to create a Looker database connection.