Thursday, 22 June 2017
Technical

Connect Cloud Database Service using SSH and Port Forwarding

Oracle Database Client uses port ranges in from 1520-1530 to connect database over TCP/IP, default listener port is 1521. These ports are not available on secure public cloud. So how to connect to cloud database?

You need to use SSH and port forwarding. Let’s see how to connect Oracle Cloud Database using Oracle SQL Developer. We will use Oracle ERP database on cloud and SQL Developer for demonstration.

SSH Setup in Oracle SQL Developer

Open SQL Developer and click on View -> SSH toolbar. This brings ssh window as shown below. Select SSH Hosts and right click to create New SSH Host…

SQL Developer ssh window



Enter details as shown in below image and click on OK. You need to use open ssh key generated while instance setup and add a local port forward. Check respective check box and select appropriate information.

oracle-sql-developer-ssh-details

  • Name: Any valid user defined name
  • Host: IP Address of Oracle Cloud Instance
  • Username: OPC is default username
  • Use key file: Browse and select putty generated open ssh key
  • Check Add a Local Port Forward
  • Name: Specify proper name
  • Host: IP Address of Oracle Cloud Instance

Test SSH connection

SSH setup is complete and now let’s connect and test it before connecting to database. Navigate to SSH Hosts window. Select newly created connection, right-click and you can either click on Test or Connect.

oracle-sql-developer-ssh-connect

If your key is secured by Passphrase, enter that key and click on connect.

oracle-ssh-connection-test-connect

Connect to Database

Now let’s connect to the database. Navigate to Connections window, select Connections, right-click and click on new connection.

Enter details as shown below. Choose connection type as SSH as we are not using TCP/IP here. Choose Port Forward as recently created ssh connection and service name ebsdb. Save the connect and click on connect.

oracle-sql-developer-database-ssh-connection

Open a SQL sheet and run any query to see the results.

sql-developer-successful-ssh-database-connection

Let me know if you find this article useful in comments section below. Do let me know if you need any help to set up it.

Leave a Reply

%d bloggers like this: