SQL Developer – Oracle Database connection through an SSH tunnel

I’ve been using the Oracle Cloud Database for a while now.  I connect through an SSH tunnel and I love the convenience.

Up to now, I’ve been making my tunnel in the terminal like so:

To end it I find the pid of the ssh connection and kill it.

The problem is, I often forget to kill it and/or I attempt to start it multiple times throughout the day.  This isn’t a big problem, just a minor annoyance.

Use Tools

I use Oracle’s SQL Developer to do my database work and was complaining to myself that ‘my IDE should handle this!’

Then I happened to notice the SSH item in the view menu.


Yes, I often complain before looking for a solution.

Add an SSH Host

In the menu, clicking View/SSH brings up the SSH panel.  So let’s add a new Host.

Right click SSH Host then click New SSH Host


Fill in the Name, Host and Username, if you’re using a key file, check the box and select the file.

Check the Add a Local Port Forward box and give it a name.  Change any of the default values, if you need to, or just hit ok.


To test it, right click on your new SSH host and click Test.



Add a Connection

Create a new connection just like normal.

Change the connection type to SSH and select your new Port Forward from the list.


Click Test.  Assuming everything is correct and you get a Status:  Success, click Save.

Now use your new connection as you always have and SQL Developer will handle the SSH connections.

4 thoughts on “SQL Developer – Oracle Database connection through an SSH tunnel”

  1. looks like the DB has to be running on the ssh host. What if the DB is running on a host other than the SSH host but behind the firewall that the SSH host allows you to tunnel through. How is that done? This feature looks specific to Oracle Cloud implementations.

    1. Hitting another machine after passing the firewall is a bit beyond what I’ve done. If I were to search for an answer, I would first look at how to just make a regular SSH connection through the firewall to the 3rd machine. Once you know that, then add the “tunnel” arguments.

    2. Hi Bob,

      That should be possible by entering your DB server name in the host field i.o. ‘localhost’ in the ‘New SSH Host’ screen. I’m not using SQL Developer, but the configuration described by Blaine is very similar to what I use in Idea/RubyMine or DBeaver.

      Good luck.

Leave a Reply