Quadcap Software

Quadcap Embeddable Database

Quadcap Software

Installation and Configuration

Installation

The QED distribution is packaged as a compressed '.tgz' file, built using GNU tar and gzip. You can extract the files from this archive using GNU tar and gzip:

tar xzf qed-${VERSION}.tgz
      

On Windows, WinZip (or the Cygnus tools, or any of several different archive handlers) can be used to extract the QED files from the archive.

Using the QED JDBC Driver in your Application

To use the QED JDBC Driver in your application, add qed.jar and antlr.jar to your classpath, e.g.:

set CLASSPATH = %CLASSPATH%;c:/qed/lib/qed.jar;c:/qed/lib/antlr.jar
	

On-line Documentation

The QED documentation set is included in the distribution in the doc directory. Point your browser at install-root/docs/index.html.

Application Development

Attaching to the QED JDBC Driver

Before the QED JDBC Driver can be used, it must be registered with the JDBC DriverManager. This is most easily done by simply causing the QED Driver class to be loaded; the static initializers in the driver class then register the driver with the DriverManager.

Class.forName("com.quadcap.jdbc.JdbcDriver");
	

At this point, the driver manager is ready to begin creating connections to the database. A connection is established using the JDBC DriverManager.getConnection method, with a URL constructed in this manner:

jdbc:qed:database-name
	

Note that unlike conventional JDBC drivers, the QED JDBC driver imposes minimal overhead for creating and destroying database connections. You can still use a ConnectionPool class if you want, but the QED driver significantly reduces the need for connection pooling.

There is no limit to the number of databases that may be opened simultaneously -- they are distinguished based on the database name in the URL.

Database Creation

To create a database, simply connect to it, specifying the name of the directory where the database is to be created, and adding the property create=true in the java.util.Properties object that's passed to DriverManager.getConnection().

Database Files

This is implementation specific, and is subject to change, but following is a summary of the files that may be created in the database directory:

Database Files
datafile The principal file containing all of the schema, data, and indices that make up the database. Future versions of QED may support multiple datafiles.
lockfile The lockfile is used to prevent multiple JVM's from attempting to access the database simultaneously, which would lead to corruption of the database. If the JVM aborts, it won't get a chance to delete this lockfile, in which case you may need to manually remove it in order to restart the database.
before-images For failure-recovery purposes. Uncommitted transactions are permitted to write pages directly to the datafile; this file records the image of that page as of the last checkpoint. On restart, the datafile is recovered from these before-images, then transaction redo/undo is applied from the logs to bring the database back to a consistent state.
logfile QED uses write-ahead logging, where each operation that modifies the database first writes a log entry. These log entries are used for statement rollback, transaction rollback, and failure recovery. Periodic checkpoints cause the current log to be purged of entries for completed transactions which have been committed to durable storage.
temporary This file contains log images for BLOB and CLOB data, as well as temporary tables and indexes generated internally by operations such as ORDER BY and JOIN.
deferred-log This file contains log entries generated while a rollback is in progress. Once the rollback is complete, the deferred-log entries are moved to the main log.

Backup/Restore

QED contains a robust failure recovery mechanism, due to its inbuilt logging and checkpointing mechanisms. Still, backups are a very good idea. Several approaches can be taken to backing up a QED database.

One technique is to perform an off-line backup by simply using a system utility to back up the files in the database directory.

If you have QED Web Server Edition, on-line backups can be performed using the QED Administrator application, and can be configured to automatically run at scheduled times using the QED Administrator. These on-line backup operations extract the data from the database and dump it in XML form, using the XmlDump Utility.

Another approach to on-line backups is to directly use XmlDump under control of your application.