A Simple Program in Oracle NOSQL

As an initial step let us examine the following program which is a very simple piece of code that writes a single key-value pair and then reads the value associated with the key. The primary APIs of the Oracle NoSQL Database are written in Java.

Prerequisite

Download and install Java SE 1.6 or later.

Download and install Eclipse.

Download and install Oracle NOSQL.

Step – 1

Check that KVLite is running or not. KVLite is a lightweight version of the Oracle NoSQL database server that runs on a single node, has a single replication group, and is packaged inside of the kvstore.jar file located in the lib folder in the KVHOME directory.

Verification

Step 2

Start the Eclipse IDE and select the workspace where you want to save your works.

workspace

Step – 3

Next to create a new Project click on File >> New >> Project .

file new pr

Step – 4

Select Java Project and Click on Next.

new pr

Step – 5

Provide a name for the Project. Note that JRE Environment is correct and click Finish.

java pr

Step – 6

Next Create a package under newly created Java Project ‘HelloNOSQL’by right clicking on it  >> New >> Package.

new package

Step – 7

Provide a Name to the Package and click on Finish.

new pack

Step – 8

Next Right click on Package ‘hello’ and select import to import codes from Examples folder.

imp

Step – 9

Select the Import Type and Click on Next.

file system

Step – 10

Navigate to examples folder and select folder hello.

import from

Step – 11

Click ‘Select All’ to select all the contents of folder hello. Finally click Finish.

import

Step -12

If the import gets successful you will be able to see all imported files under selected package.

imp success

Step – 13

Next we need to add Libraries. To do so right click on Project and select Properties.

properties

Step – 14

Next Select Java Build Path >> Libraries and then Add External JARs.

add lib

Step – 15

Navigate to lib folder and select kvclient.jar

kvclient

Step – 16

Next we need to debug the imported codes. To do so right click on Project >> Debug As >> Debug Configurations.

debug as

Step – 17

Select the option ‘Stop in Main’ and click on Debug.

debug

Step – 18

The output of Debug appears as below.

debug option

Step – 19

To run the code Click on Run and select ‘HelloBigDataWorld’.

run

Step – 20

Finally the output of the code appears as below.

run+output

Leave A Reply

Your email address will not be published. Required fields are marked *