How to Connect to Oracle Cloud Database Using Sql Developer

Before You Begin

Purpose

This tutorial covers how to connect to a Oracle Database Cloud Service (DBCS) instance using Oracle SQL Developer.

Time to Complete

Approximately 30 minutes.

Introduction

When you create an Oracle Java Cloud Service (JCS) instance you always need to provide a pre-existing Oracle Database Cloud Service instance to which your JCS instance will connect.
This tutorial shows you how to identify the underlying DB service details and use them to create a connection from a local machine running Oracle SQL Developer.

Software Requirements

Oracle SQL Developer
Oracle SQL Developer must be installed on your local machine.

Prerequisites

Before starting this tutorial, you should have:

  • A JCS instance already available.
  • Oracle SQL Developer installed your computer, as listed above.

Identifying Oracle DB Cloud Service in use

Find the Oracle Database Cloud Service instance in use

  1. Sign in to the My Services application at https://cloud.oracle.com/sign_in after selecting the appropriate Public Cloud Services Data Center option. The My Services Dashboard appears.

  2. In the Oracle Java Cloud Service section, click Open Service Console. The Oracle Java Cloud Service Console page is displayed. An example is shown in the following illustration.

    open service console
    Description of this image
  3. On your Oracle Java Cloud Service Console, click the link that represents the service instance you want to manage.

    choosing service instance
    Description of this image

    The details of the selected service instance show up, including a list with all the machines that make up the service. Right below the machine list, there is the Associated Services section. There you will find the name of the Oracle Database Cloud Service instance this JCS instance is using.

    database cloud instance name
    Description of this image

Find the Oracle Database Cloud Service instance connection details

  1. Scroll up to the top of the page. Click Consoles and then click on the Database Cloud Service item.

  2. dbcs instancesDescription of this image

    The Oracle Database Cloud Service Console page is displayed, showing the list of DBCS instances available to you.

    dbcs instances
    Description of this image
  3. On your Oracle Database Cloud Service Console page, click the link that matches the service instance name you collected in previous step. In our example wlsdb.

    select service instance
    Description of this image

    The details of the selected DBCS instance show up, including the DB machine public IP address, the listener port and the instance name. The Connect Descriptor attribute tells us about the service name that we will use.

    connect_descriptor_attribute
    Description of this image

Enabling Access to the DBCS Instance from the local machine

By default, the DBCS instance is not reachable to IP addresses outside your cloud service identity domain. In order to connect to the DBCS instance using desktop tools, such as Oracle SQL Developer, we have two choices:

  1. Create an SSH tunnel and configure port forwarding appropriately
  2. Enable the access rule that grants access to the DB service from external IPs

The steps that are required to create an SSH tunnel to gain access to specific services running on the Oracle Cloud Services VMs from the local computer are fully documented in a number of different tutorials, for example:

  • Creating an SSH Tunnel to a Port in the Virtual Machine
  • Connect to a Database Cloud Service (Database as a Service) Instance Through an SSH Tunnel

Now, we will focus on how to change the access rule in this tutorial

.

Locate the access rule that is preventing us from getting access to the DB service from external IPs

  1. If not already signed in to the My Services application at https://cloud.oracle.com/sign_in, do so again after selecting the appropriate Public Cloud Services Data Center option. The My Services Dashboard appears. (Or you can access the Compute Cloud Service from the Consoles menu, like we did above when navigating from JCS to DBCS)

  2. In the Oracle Compute Cloud Service section, click Open Service Console. The Oracle Compute Cloud Service Console page is displayed. An example is shown in the following illustration.

    compute cloud service console
    Description of this image
  3. Click Network to see the existing list of access rules

    click_network
    Description of this image
  4. Enter ora_p2_dblistener as the access rule name and click the magnifier icon search.png. That will filter out from the list access rules that are of no interest at this moment.

    filter_access_rules
    Description of this image
  5. Hover the access rules so that a tooltip shows up. Locate the VM that hosts the database Service to which you want to get access. If you have trouble finding the rule, remember that it is initially disabled and therefore decorated with the badge_delete_23.png icon

    locate_the_vm
    Description of this image

Edit and enable the access rule

  1. Click the preferences preferences-new-16x16.png icon and select Update

    update_access_rule
    Description of this image
  2. On the Update Access Rule dialog, change Status to Enabled and click Update.

    update status to enable
    Description of this image

Connecting to the DB using Oracle SQL Developer

Once we know the connection details to the underlying DB service and access from the local machine has been enabled, we may connect to the DBCS instance from Oracle SQL Developer as we would do for an on-prem database service.

Connecting to the DB using Oracle SQL Developer

  1. Start Oracle SQL Developer

  2. In the Connections view click on the  icon to create a new DB connection

    create new db connection
    Description of this image

    Use the public IP address, the listener port and the service name details obtained in Identifying Oracle DB Cloud Service in use to fill out the form. Click Test and, when succeeded, click Connect.

    Description of this image

Test your connection

  1. Issue any valid SQL clause to test your newly created connection.

    test_new_connection
    Description of this image

Want to Learn More?

  • Introduction to Oracle Database Cloud Service - DBaaS Series

  • Learn More About Oracle Database Cloud Service

How to Connect to Oracle Cloud Database Using Sql Developer

Source: https://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/paas/accessdbinstance/accessdbinstance.html

0 Response to "How to Connect to Oracle Cloud Database Using Sql Developer"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel