JCDatabase is a simplified version of JDBC (Java Database Connectivity) that lets developers use Java's write once, run everywhere capabilities for cross-platform applications that need data access. JCDatabase has the following advantages over JDBC:
JCDatabase was originally written to allow games to have fast access to a local file system for saving and retrieving the player's data using a relational database. It was also used in the 3DMatrix product to save and retrieve data conveniently and has been used succesfully in many other commercial products.
It is much nicer to arrange data in tables and perform queries rather than using an ad-hoc approach to creating data files and dealing with stored data in general. If you want to be storing data from your Java application and you prefer to use a relational database approach, then JCDatabase might be an ideal set of Java classes for your needs. JCDatabase also works beautifully for Servlets, allowing multiple people could access the same database.
Let us say that we want to create a database table that stores the names of people and their year of birth. To create a table you firstly have to make a text file containing the definition of the table columns. This file must have the same name as the table and with a .def extension. In our particular case the table definition text file could be:
We need to save this text file as people.def and then we can add the following code to our Java Application, Applet or Servlet to establish a reference to the table. Make sure that you have the file jcdatabase.jar in one of the directories within your CLASSPATH.
So far there has only been one line of code and we already have a reference to our table. To create a row of data for our table, you can use:
You could use the alternative syntax to acheive the same thing with one line of code:
If you then wanted to delete all the rows in which the person's last name was 'Cochran', you would add the following code:
To change the first name of anyone called "Julian" to "Jules", you use the update method in the following way:
And if you wanted to select all the rows in which the year of birth is less than 1980 you would add:
And to print the results of that query, the following code works fine:
Within this section we have covered all of the essential concepts that allow you to do anything with your database -- inserting, updating, deleting and querying rows. The complete JCDatabase API can be viewed here.
To do the same things with JDBC you need to write a lot more code, install and configure software if accessing a local database, or be charged by your ISP if you wish to access your own ODBC or JDBC database on their server. JCDatabase bypasses these requirements by using Java's standard IO classes and a simple direct file access design.
JCDatabase can be deployed with (1) Java Applets accessing the customer's local database, (2) Java Applications running on the client accessing the customer's local database, (3) Java Servlets or Applications running on a server accessing a server database.
In the case of deploying JCDatabase with a traditional client-side application, you can simply deploy your product by making a ZIP file available to the customer containing the following files:
You can download JCDatabase jcdatabase.zip here. This version includes a running example of a simple database and requires that your tables do not exceed 100 rows. I express many thanks to anyone willing to purchase JCDatabase. I have spent a lot of time putting these classes together and I am sure you understand that it is reasonable to ask for a small fee. To obtain the unrestricted version you may order JCDatabase by credit card here. You will then receive the latest version of JCDatabase via email.
Please email me at email@example.com to ask any question about how JCDatabase works and to enquire about the range of applications for which JCDatabase has proven to be most effective.