0
votes

I am trying to connect Tableau to a postgres DB using a SSH tunnel. The steps I have taken are

  1. Install postgres drivers (32 bit) on my desktop
  2. Create the tunnel in putty (tunnel L5432 127.0.0.1:5432) and open up the terminal
  3. From this session I can run Postgres from the command line psql -d mydb -U myuser
  4. However, when trying to connect using Tableau I get the error message "Invalid username and Password"
  5. If I try to connect to a DB that doesn't exists I get the same error message "Invalid username and Password"

I have also created a psql user with superuser privileges but no success. Note that the username for the ssh tunnel and the psql db are different.

I have seen a number of posts on the forum with no solution.

Can anyone help? Thanks.

Roger

1
Does it work if the user for the tunnel and the DB are the same?Talvalin
Resolved this issue - had to create two tunnels. The postgres db had restricted list_addresses. The first tunnel got me to the box and the second allowed sql query!Roger Gill

1 Answers

1
votes

I met with the same question, with slight difference, I didn't use PuTTY but instead using Cygwin Autossh.

The answer is that two tunnels need to be built, first an ssh tunnel from local host to server, and then from the server port to the database port. A possible solution is to set up ssh tunnel like this: 5432:localhost:5432 username@hostserverdomain

The first 5432 is the local port(Tableau or PGAdmin), the second localhost actually refers to the server(cuz once log in localhost means the server itself), the second 5432 is the database on the server. And in order to get access to the database, one has to log in the server. The above is just the syntax to connect thru two tunnels using ssh.

At first I didn't understand what Roger means by two tunnels, and then I look into the underlying methodology and finally got all the setup work done. Thanks Roger!