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.

Step 2

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

Step – 3

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

Step – 4

Select Java Project and Click on Next.

Step – 5

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

Step – 6

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

Step – 7

Provide a Name to the Package and click on Finish.

Step – 8

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

Step – 9

Select the Import Type and Click on Next.

Step – 10

Navigate to examples folder and select folder hello.

Step – 11

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

Step -12

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

Step – 13

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

Step – 14

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

Step – 15

Navigate to lib folder and select kvclient.jar

Step – 16

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

Step – 17

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

Step – 18

The output of Debug appears as below.

Step – 19

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

Step – 20

Finally the output of the code appears as below.

Leave A Reply

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