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 NodeJs and RESTful API. The below section describes the 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 you can use to write your Oracle NoSQL Database applications.
· Tables API
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. A single top-level row in a table is contained in a Row object. Row is used as return value for TableAPI get operations as well as a key plus value object for TableAPI put operations. All rows in a given table have the same fields. Tables have a well-defined primary key which comprises one or more of its fields, in order. Primary key fields must be simple (single-valued) data types. To Read more about the supported data types, operations and other methods in the Table API read the guide
· Key/Value pair API or the KVStore
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. To Read more about the key/value pair API read the guide
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.
Data create and update operations are provided by several put methods:
The delete and deleteIfVersion methods unconditionally and conditionally remove key/value pairs from the database, respectively. Just as putIfVersion ensures read-modify-write semantics, deleteIfVersion provides deletion of a specific version.
Data fetch operations are provided by several get methods:
In addition to basic CRUD operations, Oracle NoSQL Database supports two types of iteration: unordered iteration over records and ordered iteration within a Major Key set. The API supports both individual key/value returns using several storeIterator methods and bulk key/value returns within a Major Key Path via the various multiGetIterator methods.
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.
CRUD using RESTful API
Starting with release 184.108.40.206.5 support for RESTful API 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:
Metadata access consists of HTTP GET to provide services to read NoSQL metadata. To find out more details please read the guide
Refer the API guide to understand various operations for Reads, Writes, Consistency and Durability.