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:
ssh -i ~/.ssh/myKey -f email@example.com -L 1521:192.168.0.123:1521
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.
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.