4 Getting Started with the Application

To develop a Java application that connects to Oracle Database 12c Release 2 (12.2), you must ensure that certain components are installed as required. This chapter covers the following topics:

4.1 What You Need to Install

To be able to develop the sample application, you need to install the following products and components:

The following subsections describe these requirements in detail.

4.1.1 Oracle Database 12c Release 2 (12.2)

To develop the Java application, you need a working installation of Oracle Database 12c Release 2 (12.2) Server with the HR schema, which comes with the database. The installation creates an instance of Oracle Database 12c Release 2 (12.2) and provides additional tools for managing this database. For more information, refer to the following Oracle Database 12c Release 2 (12.2) installation guides and release notes:

  • Oracle Database Installation Guide for Linux

  • Oracle Database Installation Guide for Microsoft Windows

4.1.1.1 Unlocking the HR Schema for the JDBC Application

The HR user account, which owns the sample HR schema used for the Java application in this guide, is initially locked. You must log in as a user with administrative privileges (SYS) and unlock the account before you can log in as HR.

If the database is locally installed, use the Run SQL Command Line to unlock the account as follows:

  1. To access the Run SQL Command Line, from the Start menu, select Programs (or All Programs), then Oracle Database 12c Release 2 (12.2), and then click Run SQL Command Line. Log in as a user with DBA privileges, for example:
    > CONNECT SYS AS SYSDBA;
    Enter password: password
    
  2. Run the following command:
    > ALTER USER HR ACCOUNT UNLOCK;
    

    or,

    > ALTER USER HR IDENTIFIED BY HR;
    
  3. Test the connection as follows:
    > CONNECT HR
    Enter password: password
    

You should see a message indicating that you have connected to the database.

Note:

For information about creating and using secure passwords with Oracle Database 12c Release 2 (12.2), refer to Oracle Database Security Guide.

In addition, some of the constraints and triggers present in the HR schema are not in line with the scope of the Java application created in this guide. You must remove these constraints and triggers as follows using the following SQL statements:

DROP TRIGGER HR.UPDATE_JOB_HISTORY;
DROP TRIGGER HR.SECURE_EMPLOYEES;
DELETE FROM JOB_HISTORY;

4.1.2 J2SE or JDK

To create and compile Java applications, you need the full Java 2 Platform, Standard Edition, Software Development Kit (J2SE SDK), formerly known as the Java Development Kit (JDK).

Note:

Oracle Database 12c Release 2 (12.2) supports JDK 8.

See Also:

4.1.3 Integrated Development Environment

For ease in developing the application, you can choose to develop your application in an integrated development environment (IDE). This guide uses Oracle JDeveloper to create the files for this application.

4.1.4 Web Server

The sample application developed in this guide uses JavaServer Pages (JSP) technology to display information and accept input from users. To deploy these pages, you need a Web server with a servlet and JSP container, such as the Apache Tomcat application server.

This guide uses the embedded server called the Oracle WebLogic Server in JDeveloper for deploying the JSP pages. If you choose not to install Oracle JDeveloper, then any Web server that enables you to deploy JSP pages should suffice.

JDeveloper supports direct deployment to the following production application servers:

  • Oracle WebLogic Server

  • Oracle Application Server

  • Apache Tomcat

  • IBM WebSphere

  • JBoss

For more information about these servers, please refer to vendor-specific documentation.

4.2 Oracle Database Cloud — Starting with Oracle Database as a Service

Prerequisites for Using Oracle Database Cloud Service

Before getting started with Oracle Database Cloud Service, you should be familiar with the following concepts:

  • Oracle Cloud

  • Oracle Compute Cloud Service

  • Oracle Storage Cloud Service Controllers

    Database Cloud Service uses Oracle Database Backup Cloud service to back up data on cloud storage.

    Database Backup Cloud Service, on the other hand, uses Oracle Storage Cloud Service containers as repositories for backups to the cloud. Hence, before you can create a container, you must have a subscription to Oracle Storage Cloud Service.

What You Need to Create a Database Cloud Service Instance

  • A Database Cloud Service Subscription

  • A Secure Shell (SSH) public/private key pair to enable secure access to compute nodes supporting the database (optional)

  • A container in Oracle Storage Cloud Service to store backups on cloud service

Getting Started with Database Cloud Service Subscriptions

Use the following steps to get started with Oracle Database Cloud Service (trial and paid) subscriptions:

1 Request a trial license, or purchase a license to Oracle Database Public Cloud Services.

2 Set up your Oracle Database Public Cloud Services account.

Note:

Refer the following link to download Oracle Database Cloud Service https://cloud.oracle.com/database

3 Verify if your Database Cloud Service is ready to use.

4 Know more about Oracle Database Cloud Service users and roles.

5 Create accounts for users with required privileges

For more information on how to get started with Oracle Database Cloud Service, refer:

https://docs.oracle.com/en/cloud/paas/database-dbaas-cloud/csdbi/get-started-this-service.html

4.3 Verifying the Oracle Database 12c Release 2 (12.2) Installation

Oracle Database 12c Release 2 (12.2) installation is platform-specific. You must verify that the installation was successful before you proceed to create the sample application. This section describes the steps for verifying an Oracle Database 12c Release 2 (12.2) installation.

Verifying a installation involves the following tasks: