March 31, 2012
c-treeDB Does Java the Record-Oriented Way
Relational databases were a standard solution long before Java was created in the Sun laboratories. Leveraging this technology was an easy choice at that time and JDBC became the de facto standard for many, if not most, data environments.
As with most “one-size-fits-all” solutions, a fully relational approach may not always be the most appropriate choice. This first surfaced in the object-relational dilemma, which was addressed with the persistence layer. (Expect exciting news about the way c‑treeACE will integrate into this soon!)
Currently, the “NoSQL” movement has shown alternatives are welcome advances to these long existing standards. Some of these recent non-relational alternatives also have a Java API. So what about c‑treeACE and Java?
c‑treeDB
When FairCom introduced a standard SQL interface incorporating c‑treeACE core technology, it was clear that an intermediate relational interface would be desirable. This standard interface was named c‑treeDB, referring to “c-treeACE database.” Concepts such as sessions, databases, tables, and fields, common to the relational world but nearly nonexistent in the ISAM world, were added and this became a new easy-to-use standard for record-oriented (ISAM) programming with c‑treeACE. Besides the popular C/C++ c‑treeDB interfaces, two other APIs were added based on c‑treeDB concepts: VCL for Delphi/CBuilder and a complete .NET assembly written in C#.
FairCom has long realized the importance of this interface for Java, and c‑treeDB Java now introduces this to the Java community. If you are familiar with c‑treeDB in any of the other languages, you will find it very easy and straightforward to incorporate c‑treeDB Java. If you are already familiar with Java and require database access, it is very likely that you use JDBC.
Example
The sample code below demonstrates the same program (c‑treeACE customer master tutorial 3) when using these different APIs. JDBC is presented for those familiar with Java’s JDBC, c‑treeDB C++ for those experienced with c‑treeACE, and the new c‑treeDB Java.
In each example, we perform an initialization, the table definition, searches and updates.
c‑treeACE SQL JDBC
c‑treeDB C++
c‑treeDB Java
c‑treeDB Java looks a lot like c‑treeDB.NET! Indeed, these APIs are nearly kissing cousins of each other. FairCom has endeavored to keep as true to the Java environment as possible, retaining all of the c‑treeDB concepts and features.
Note: A complete set of all four tutorials is provided with c‑treeACE for each of the three APIs, as well as for many other supported APIs, both SQL and record-oriented.
Performance over SQL Models
If your application requires ultimate control of how your data is handled and Java is your language, you will not find a better approach than c‑treeDB Java. Imagine taking a general JDBC application and solving database bottlenecks (especially those related to input and data positioning/navigation) with a few simple low-level commands. That is the performance gain offered by c‑treeDB Java.
In a recent test, a thin layer on top of c‑treeDB Java was enough to reduce the CPU usage from 80% to 20% and provide a higher data throughput than a leading RDBMS system, running on IBM P6 hardware.
As always with c‑treeACE, you can mix and match both APIs – SQL and record-oriented – in the same application, over the same set of data. However, you are responsible at the application level to maintain relational aspects of the database from record-oriented handling when using the c‑treeDB Java API.
There are multiple use cases for non-relational databases. If your solution is already based on c‑treeACE and you need non-relational access to your data via Java, or if you’re developing new Java applications requiring a solid efficient database that is better performing than a relational engine, c‑treeDB Java may be your choice.
Contact your nearest FairCom office and talk to us about your specific needs, and let one of our experts work with you directly for how to best incorporate c‑treeACE technology into your next big project.