To assists the Application developers, Oracle NoSQL Database provides extensive support of API and drivers in various programming languages such as C, Java, Python and Node.js and RESTful API. Below, is a description of CRUD APIs with Java.
CRUD Operations in Java
Using Java API that are shipped with the product Application developers can access the data in the Oracle NoSQL Database. There are two different programming paradigms or interface that cyou can use to write your Oracle NoSQL Database applications.
TableAPI is a handle for the table interface to an Oracle NoSQL store. Tables are an independent layer implemented on top of the key/value interface. While the two interfaces are not incompatible, in general applications will use one or the other. To create a TableAPI instance use getTableAPI(). The table interface is required to use secondary indexes and supported data types.
Tables are similar to tables in a relational database. They are named and contain a set of strongly typed records, called rows. Rows in an Oracle NoSQL Database table are analogous to rows in a relational system and each row has one or more named, typed data values. These fields can be compared to a relational database column. Tables have a well-defined primary key which comprises one or more of its fields, in order.To Read more about the supported data types, operations and other methods in the Table API read the guide.
KVStore is the handle to a store that is running remotely. To create a connection to a store, request a KVStore instance from KVStoreFactory.getStore (). A handle has thread, memory and network resources associated with it. Consequently, the close() method must be invoked to free up the resources when the application is done using the KVStore.
To minimize resource allocation and deallocation overheads, it's best to avoid repeated creation and closing of handles to the same store. For example, creating and closing a handle around each KVStore operation, would incur large resource allocation overheads resulting in poor application performance.
If you need to use like secondary indexing, we recommend using the tables API because it that do no appear in the key/value pair API. Refer the guide for Key/Value API for more details.
In addition to providing single-record operations, Oracle NoSQL Database supports the ability to bundle a collection of operations together using the execute method, providing transactional semantics across multiple updates on records with the same Major Key Path. Oracle NoSQL Database supports optimized bulk gets i.e pass a list of primary keys to get iterator over all the matching records. Refer the API documentation.
CRUD using RESTful API
Oracle NoSQL Database supports a RESTful API that has been added using Oracle REST Data Services. This allows exposing Oracle NoSQL Database tables as REST API endpoints.
The data stored in the tables can be created, queried, updated and deleted using REST.
Oracle REST Data Services can provide HTTP-based REST service access to Oracle NoSQL Database, through operations on the NoSQL data and metadata.
Data access consists of CRUD (create, read, update, delete) operations on NoSQL tables:
Create: HTTP POST and PUT to provide services to create row data.
Read: HTTP GET to provide key, partial key, and field range queries on row data, with directives for consistency and order.
Update: HTTP PUT to provide services to update row data.
Delete: HTTP DELETE to provide services to delete row data.
To find out more details please read the guide.
Refer to the guide to understand the details along with examples on how to connect to the kvstore, create table and indexes, and write to the table rows.
The Node.js driver is available at npm. For the API reference, the guide is available here.
Python support is also avaliable. Refer to the Python guide to understand the details along with examples on how to connect to kvstore, create table, indexes and perform update and delete operations. The python client module nosqldb.py to access Oracle NoSQL Database stores is required. The module can be downloaded from Python Software Foundation.