Lexical Tools

JDB (Java Database)

Description

Java Database classes are developed base on Java Database Development (by Martin Rinehart). It provides ready-to-use, 100% pure Java classes for adding local database and BTree-based indexed access classes to all types of applications.

Capability

JDB was developed within a relative short period. Limited tests were performed for all classes in JDB. Currently, JDB provides following classes:

  • DBF: is used to store database table schema and table records.
  • NDX: is used to index key by using B-tree.

Limitations

  • It takes a relative longer time to index a large amount of records.
  • Currently, only the search function is implemented. No other functions are available. In other words, this JDB is only good for simple table lookup.
  • Only 4 data types are provided, C (Char), D (Date), N (Number), and L (Logical).

Usage Summary

  1. Define the table schema: by editing a flat file "xxx.sin"
  2. Transfer flat file into DBF format ("xxx.dbs") by using Dbs-class.
  3. Define the table records by editing a flat file "xxx.fin".
  4. Use CreateDbf class to create DBF file ("xxx.dbf") from xxx.fin and xxx.dbs.
  5. Use NDX class to index interested fields and generate index file "xxx.ndx".
  6. Perform search function by using "xxx.ndx" and "xxx.dbf". The NDX file is generated at the very first time when field is indexed. NDX file stores B-tree structure in a binary format and can be reopened for persistent use. A method find (key) in NDX class returns the record number for the key. By using this record number and random access file "xxx.dbf", the full record can be retrieved.

References

Please refer to Java Database Development, by Martin Rinehart, for details.