The Oracle NoSQL Database Blog covers all things Oracle NoSQL Database. On-Prem, Cloud and more.

  • March 31, 2020

15 Minutes to Hello World

Michael Brey, and Dave Rubin

Oracle NoSQL Database Cloud Service – 15 Minutes to Hello World


Guest Post by:
Dave Rubin, Senior Director, NoSQL and Embedded Database Development, Oracle

The Oracle NoSQL Database Development team is thrilled to have the Oracle NoSQL Database Cloud Service fully integrated on the native Oracle Cloud Infrastructure. 

In this post, I will walk through the steps to write a simple Hello World application using the recently integrated Oracle NoSQL Database Cloud Service.  You will also see that writing your first Hello World application can be accomplished in 15 minutes or less.  You may first be wondering, why use a NoSQL Database and what is the Oracle NoSQL Database Cloud Service?  These are great questions and ones that I will discuss before getting into the code.

Why use a NoSQL Database?

Modern application developers have many choices when faced with deciding when and how to persist a piece of data.   In recent years, NoSQL databases have become increasingly popular and are now seen as one of the necessary tools in the toolbox that every application developer must have at their disposal.  While tried and true relational databases are great at solving classic application problems like data normalization, strictly consistent data, and arbitrarily complex queries to access that data, NoSQL databases take a different approach.  

Many of the more recent applications have been designed to personalize the user experience to the individual, ingest huge volumes of machine generated data, deliver blazingly fast, crisp user interface experiences, and deliver these experiences to large populations of concurrent users.  In addition, these applications must always be operational, with zero down-time, and with zero tolerance for failure.  The approach taken by Oracle NoSQL Database is to provide extreme availability and exceptionally predictable, single digit millisecond response times to simple queries at scale. The Oracle NoSQL Database Cloud Service is designed from the ground up for high availability, predictably fast responses, resiliency to failure, all while operating at extreme scale. Largely, this is due to Oracle NoSQL Database’s shared nothing, replicated, horizontal scale-out architecture and by using the Oracle NoSQL Database Cloud Service, Oracle manages the scale out, monitoring, tuning, and hardware/software maintenance, all while providing your application with predictable behavior.

Getting Started with the Oracle NoSQL Database Cloud Service

The Oracle NoSQL Database Cloud Service is a server-less, fully managed data store that delivers predictable single digit response times and allows application to scale on demand via provisioning API calls.  There are four simple steps to getting started with the Oracle NoSQL Database Cloud Service.

  • Download the Oracle NoSQL Database driver
  • Connect to the Oracle NoSQL Database Cloud Service
  • Create a table with provisioned reads/sec, writes/sec, and GB storage
  • Write data to the table and read data from the table

Furthermore, you can use your free cloud credits to do all of this and not pay a single penny. 

Once you have created a cloud account, you can either navigate to the Oracle NoSQL Database table management console, or if you are like most developers, quickly move onto writing your first hello world code.  For this release of the Oracle NoSQL Database Cloud Service, you can write your first hello world program using Python, Node.js, Java, or Go.  Future releases of the service will support C++, C#, and other popular programming languages.  I will use Java for the remainder of this blog.  Java 8 and Java 11 are certified.

Download the Oracle NoSQL Database Driver

Since access to the Oracle NoSQL Cloud Service is via HTTP, you can run your application directly on your laptop and connect to the database service over the internet.  While I would never recommend using the internet as a network transport for performance sensitive applications, it works perfectly for our hello world example.  In fact, most likely you would want to deploy by running your application inside your own tenancy co-located in the same Oracle Cloud Infrastructure region as your NoSQL table and use the Oracle Cloud Infrastructure Service Gateway to connect to the NoSQL Cloud Service.

I’ll navigate my browser to the following URL https://www.oracle.com/downloads/cloud/nosql-cloud-java-driver-downloads.html, where I am presented with the following options:

I will choose the tar.gz file and download that one.  Once you unbundle this file, you will see a lib directory which contains the Oracle NoSQL Cloud Service driver along with a few other dependent libraries.  For this example, I am placing these files in /Users/drubin/NoSQL/oracle-nosql-java-sdk-5.2.11.  Notice the contents of the lib directory.  These are the only libraries that you will need to compile and run your hello world example.

Connect Application to the Oracle NoSQL Database Cloud Service

The Oracle NoSQL Database Cloud Service uses the Oracle Cloud Infrastructure native cloud Identity Access Manager (IAM) for authentication and authorization.  In the Javadoc (https://docs.oracle.com/en/cloud/paas/nosql-cloud/csnjv/index.html) for the driver, you will notice a new package entitled oracle.nosql.driver.iam, which currently contains a single class, SignatureProvider.    We will use this class to provide our authentication information to the cloud service. 

Before you can authenticate your application with the cloud service, you must generate a key pair and upload your public key to the Oracle Cloud.  The instructions here will guide you through generating an API signing key and uploading the public key to the Oracle Cloud https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#How

The following information will be needed for you to successfully authenticate with the cloud service:

The code below is structured as follows:

  1. The method getNoSQLConnection – This is where you will fill in your specific credentials.  This method will perform authentication with the Oracle NoSQL Cloud Service and return a handle to the service.
  2. The method createHelloWorldTable  - This method will create a table with two columns; an ID column of type LONG and a content column of type JSON.
  3. The method writeOneRecord – This method will write a single record to the hello world table.
  4. The method readOneRecord – This method will read a single record from the hello world table and return this record as a JSON string.
  5. The main() entrypoint – Will first get a connection to the service, create the table, write a single record, read that record back, and finally print that record to stdout.


If you take the code above and place it in a file entitled HelloWorld.java and you fill in your credentials in the getNoSQLConnection() method, you can compile this file as specified below:


and run the resulting class file as specified below (NOTE the JSON output from running the program):


Using the Native Oracle Cloud Infrastructure Console

You can also explore your tables using the Oracle Cloud Infrastructure console.  On the left hand menu, simply navigate to the NoSQL Database menu item.

 Once you click on the hello_world table link, you will see the following page:

Clicking on the Table rows control and then the clicking the Run query button control will display the record that you just inserted into the table:


If you have questions regarding this exercise, please send an email to oraclenosql-info_ww@oracle.com with “Hello World” in the subject line, and someone will get back to you as soon as possible.


Join the discussion

Comments ( 1 )
  • Suresh U Saturday, May 30, 2020
    Cool one
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.