Error: The Connection Attempt Failed (SSH Tunnel Connection Method)
Issue
The following error appears:
PSQLException: The connection attempt failed.
Environment
- Connector: PostgreSQL
- Connection method: Direct
Cause
The connector is unable to connect to the source database. The connection attempt may have failed for one of the following reasons:
- The remote host is terminating the connection.
- The remote host is blocking Fivetran through a firewall.
- The remote host is timing out the connection.
Resolution
- Make sure all credentials are correct.
- Verify that IPs are allowed from the public Internet to the SSH server bi-directionally on port
22
. - Tail the SSH logs to check for errors between the SSH server and the source database:
- Run either the
sudo tail -f /var/log/auth.log
orsudo tail -f /var/log/secure
command. - Run the setup tests.
- Check the tail for errors.
- Run either the
- If there's an error in connecting to the source database, show that error output to your network admin.
- Install PSQL on the SSH server to attempt connecting to the PostgreSQL database from the SSH server.
- Install PSQL on a machine separated by the Internet and connect to the source database through the SSH server. This method mimics how Fivetran connects to your database and can recreate the error conditions you see in the Fivetran dashboard.
TIP: Dbeaver is a free database connection UI that you may want to use. You can find instructions for installing PSQL with
brew
on the PostgreSQL Wiki's Homebrew page.