Connect to Oracle Cloud Database from SQL Developer

SQL Developer provides an easy way to connect Oracle Database. Just start, enter database information like Host, Service, port, and click on connect.

But, how to connect to the cloud database?

Connect Oracle Cloud Database using SQL Developer

Ports ranging from 1520-1530 are not available on secure Oracle public cloud. You need to connect the oracle database using a secure shell (SSH) and port forwarding on secure port 22.

Create New SSH Host in 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 the below image and click OK. You need to use the open ssh key generated while instance setup and add a local port forward.

  • Name: Any valid name
  • Host: IP of Oracle Cloud Instance
  • Username: enter OPC
  • Use key file: Browse and select ssh key
  • Check Add a Local Port Forward
  • Name: Specify proper name
  • Host: IP of Oracle Cloud Instance

oracle-sql-developer-ssh-details

Click OK. This creates a new SSH host.

Test SSH connection

SSH setup is complete and now let’s connect and test it before connecting to the 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

Navigate to the Connections window, select Connections, right-click and click on a new connection.

Enter the connection name, username, and password. Choose the connection type as SSH as we are not using TCP/IP here. Choose Port Forward as recently created SSH connection and service name (Oracle Database Service Name). Click the Save button to save all details so that you do not have to enter those again. Click the connect button.

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 the comments section below. Do let me know if you need any help to set up it.