GithubHelp home page GithubHelp logo

hu19891110 / soda-for-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oracle/soda-for-java

0.0 1.0 0.0 8.4 MB

SODA (Simple Oracle Document Access) for Java is an Oracle library for writing Java apps that work with JSON (and not only JSON!) in the Oracle Database. SODA allows your Java app to use the Oracle Database as a NoSQL document store.

Home Page: http://www.oracle.com/technetwork/database/application-development/oracle-document-store/index.html

License: Other

Java 99.57% HTML 0.22% PLSQL 0.21%

soda-for-java's Introduction

SODA 1.0.2

Simple Oracle Document Access (SODA) is an API from Oracle for working with JSON in the Oracle Database. Although SODA is particularly powerful when it comes to JSON data, data of any other type is supported as well.

With the SODA architecture, your data is stored as documents, and documents are organized into collections. Each document contains the actual data, as well as additional information automatically maintained by SODA, such as unique key, last-modified timestamp, version, type, etc. SODA lets you create and store such collections of documents in the Oracle Database, and perform create, retrive, update, and delete (CRUD) operations on these documents, without needing to know Structured Query Language (SQL), or JDBC, or how the data is stored in the database. Essentially SODA provides a virtual NoSQL document store on top of your Oracle Database. Under the covers, a collection is stored as a regular Oracle Database table, and each document is stored as a row in the table. SQL access to the table using standard tools is still allowed.

SODA for Java, hosted in this repository, is a library which implements SODA for use with Java. SODA for REST, which can be used from any programming language capable of making http requests, is also available. SODA for REST is not part of this repository, and is released separately as part of [Oracle Rest Data Serices (ORDS)] (http://www.oracle.com/technetwork/developer-tools/rest-data-services/overview/index.html) and documented [here] (https://docs.oracle.com/cd/E56351_01/doc.30/e58123/toc.htm).

SODA for Java supports:

  • CRUD operations on documents containing data of any type using unique document keys
  • CRUD operations on documents containing JSON data using QBEs (simple pattern-like queries-by-example expressed in JSON), or unique document keys
  • Bulk read/write operations
  • Optimistic locking
  • Transactions
  • Document collections backed by Oracle Database tables or views
  • Mapping of existing Oracle Database tables or views as document collections

SODA for Java is stable, well-documented, and has a comprehensive test suite. We are actively working on adding new features as well.

SODA for Java is built on top of native JSON support in the Oracle Database.

This is an open source project maintained by Oracle Corp.

See the Oracle as a Document Store page on the Oracle Technology Network for more info.

Getting started

The following short code snippet illustrates working with SODA. It shows how to create a document collection, insert a document into it, and query the collection by using a unique document key and a QBE (query-by-example).

// Get an OracleRDBMSClient - starting point of SODA for Java application.
OracleRDBMSClient cl = new OracleRDBMSClient();

// Get a database.
OracleDatabase db = cl.getDatabase(conn);

// Create a collection with the name "MyJSONCollection".
OracleCollection col = db.admin().createCollection("MyJSONCollection");

// Create a JSON document.
OracleDocument doc =
  db.createDocumentFromString("{ \"name\" : \"Alexander\" }");

// Insert the document into a collection, and get back its
// auto-generated key.
String k = col.insertAndGet(doc).getKey();

// Find a document by its key. The following line
// fetches the inserted document from the collection
// by its unique key, and prints out the document's content
System.out.println ("Inserted content:" + 
                    col.find().key(k).getOne().getContentAsString());
                    
// Find all documents in the collection matching a query-by-example (QBE).
// The following lines find all JSON documents in the collection that have 
// a field "name" that starts with "A".
OracleDocument f = db.createDocumentFromString("{\"name\" : { \"$startsWith\" : \"A\" }}");
                       
OracleCursor c = col.find().filter(f).getCursor();

while (c.hasNext())
{
    // Get the next document.
    OracleDocument resultDoc = c.next();

    // Print the document key and content.
    System.out.println ("Key:         " + resultDoc.getKey());
    System.out.println ("Content:     " + resultDoc.getContentAsString());
}

Note that there's no SQL or JDBC programming required. Under the covers, SODA for Java transparently converts operations on document collections into SQL and executes it over JDBC.

See Getting Started with SODA for Java for a complete introductory example.

Documentation

The documentation is located here.

The Javadoc is located here.

Build

SODA for Java source code is built with Ant and (optionally) Ivy. See Building the source code for details.

SODA for Java comes with a testsuite, built with JUnit and driven by Ant. See [Building and running the tests] (https://github.com/oracle/soda-for-java/blob/master/doc/Building-and-running-tests.md) for details.

Contributions

SODA is an open source project. See Contributing for details.

Oracle gratefully acknowledges the contributions to SODA made by the community.

Getting in touch

Please open an issue here, or post to the [ORDS, SODA, and JSON in the database forum] (https://community.oracle.com/community/database/developer-tools/oracle_rest_data_services/) with SODA-FOR-JAVA in the subject line.

soda-for-java's People

Contributors

morgiyan avatar snaugle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.