In this example,we will use the common SSH client named PuTTY. Suppose we have SSH access to machine 10.140.1.231, but we want to connect to an Oracle database running on port 1521 of machine 10.140.1.230.
The first step is to create a new session (or reuse an existing one). In this example, we will use a session named 'mordor' to connect to a host with IP 10.140.1.231 using the standard port of SSH (22):
Next step is to create a new SSH port forward. This is done in the menu 'Connection > SSH > Tunnels'. In this example, we will define a local port (in this case 1521) and a remote port (10.140.1.230:1521):
Once this is done, next step is to open the SSH connection to 10.140.1.231. As usual the terminal will ask us user and password. Once we have logged on, a local port in our computer will be defined, in this case port number 1521.
How to connect to the database ? Just start your favorite SQL client (TOAD, Squirrel, etc) and define a connection with an URL like this (note the use of 'localhost'):
jdbc:oracle:thin:@localhost:1521:MYDATABASE
The SQL client will connect to port 1521 in your computer, but PuTTY will automatically redirect the traffic to 10.140.1.230:1521 .