Product and service reviews are conducted independently by our editorial team, but we sometimes make money when you click on links. Learn more.

Is Oracle’s Non-Relational Database Right for Your Project?

Is Oracle’s Non-Relational Database Right for Your Project?

Oracle's Berkeley DB is a key-value database alternative to relational databases.Oracle's Berkeley DB is a key-value database alternative to relational databases.When data management requirements don't demand all the features of a relational database you should consider an alternative method. 

Applications often need to store data persistently. Sometimes requirements are complex, as in financial management systems, and in other cases they are less demanding, such as maintaining configuration information for multiple devices on your network.Relational databases, such as Oracle’s RDBMS, Microsoft SQL Server and MySQL, are good candidates for applications with complex requirements. When your data management requirements do not demand all the features of a relational database you should consider an alternative method. 

The opposite end of the storage management spectrum from relational databases is the flat file.It is a simple way to store data but it is quite counterstained in terms of functionality.Another option, between relational databases and flat files are key value databases such as Oracle’s Berkeley DB.

The basic data management  feature of Oracle’s Berkeley DB is the ability to store and retrieve data using keys associated with values.For example, if you want to store a record you would create a key (an arbitrary string) and save the record along with the key. Anytime you want to retrieve the data you reference the data by the key. Unlike relational databases there is no user defined schema.The logic behind the structure of your records is captured in your application logic, not in a database schema.

There are definite advantages to this data model.

It is more flexible than a conventional data model with fixed columns and data types. In a relational data model, if you want to add another attribute to a table you would need to alter the table definition. In the case of Oracle’s Berkeley DB there is no table to change; instead, you would simply write your records with the additional attribute embedded in the data value. Of course your application would have to have code to manipulate your data structures and if you do decide to change the structure, your code will need to be modified - as well - to support the multiple structures that may be stored in the database.

It is worth noting that just because you can do something like this, it is not always advisable. Consistent data structures are easier to maintain and manipulate than those with varying structures.

Moving to a key-value database means we lose some of the features of relational databases. An advantage of relational databases is that they enforce constraints, such as ensuring columns are not null when they should have a value.  With Oracle’s Berkeley DB, it is the responsibility of the application developer to program integrity checks and constraints.   

Oracle’s Berkeley DB does share some features with its relational counterparts.Both support ACID transactions.If you have a series of database operations that all must complete in order to succeed then you can wrap those instructions within a transaction and the database engine will ensure those operations are treated in a single transaction.Oracle’s Berkeley DB provides a SQL API based on SQLite so you can leverage some of your SQL programming skills in cases where you do not want to use the standard Berkeley DB API.

There is, of course, a tradeoff. 

The native API offers better performance than the SQL API.  This should not be surprising. Oracle’s Berkeley DB is as a B-tree storage system.  It does not read and write from disks in the same way as a relational database engine does.

The Oracle Berkeley DB API works with most popular programming languages including C, C++, Java, Perl, Python and Ruby.  Oracle offers a Java-version of Oracle Berkeley DB as well if you need to run the database within a Java virtual machine.  In addition to a basic data manipulation API, there is the Berkeley DB XML version of the database which supports XQuery operations on XML data structures.

Dan SulivanDan SulivanDan Sullivan is an author, systems architect, and consultant with over 20 years of IT experience with engagements in systems architecture, enterprise security, advanced analytics and business intelligence. He has worked in a broad range of industries, including financial services, manufacturing, pharmaceuticals, software development, government, retail, gas and oil production, power generation, life sciences, and education.  Dan has written 16 books and numerous articles and white papers about topics ranging from data warehousing, Cloud Computing and advanced analytics to security management, collaboration, and text mining.

See here for all of Dan's Tom's IT Pro articles.

(Shutterstock image credit: Cloud Data Folder)

Check Out These IT Videos

VIDEO: Big Data, Big Hardware, Big Software

VIDEO: The Cloud Is Inevitable - Get Training Now!

VIDEO: Cloud Services: No Buzz, No Bull

Video: The Business Case for Cloud Computing

Video: Cloud Contracts - What's In Them