File based database implementation in java

 

Objective

You are to implement a simple database using a sorted file of fixed length records. The data that you are to use for testing is in file: Parks.csv Windows compatible (cr lf). This data contains the visitation records for the US National Parks from 1904 to 2016.. The goal of this assignment is to understand and practice using file management techniques to implement a database system. Your file-based database needs to handle overflow by writing records to an overflow file that contains unsorted records.

First, create a file of fixed length records from the data provided interleaved with blank records. Your file should create space for insertions by writing one blank record between each real record. Meta-information should be stored in a non-fixed length way in a separate configuration file, e.g., “Parks.config”. The config file must also store useful data like the names of the fields (for display), the number of records, and anything else you would want to add.

So, the initial file will have 764 records, half of which are blank. When a record is inserted, the file is searched (using binary search) to find the correct location. If there is a blank record where the new record needs to go, then the blank record is simply overwritten. However, if there is no empty record available in the correct location, the original file should be re-written with new blanks inserted, including after the new record. For example, if we do 3 inserts into blank records, we would now have 385 real records in our file of 764 total records. If the next insert fails, we would create a new file with 770 total records in it (the 385 real records, each with one blank record after it).

You must not read the whole data file into memory at a time

Program Description

Create a program which offers the user the following menu of operations:

1) Create new database
2) Open database
3) Close database
4) Display record
5) Update record
6) Create report
7) Add record
8) Delete record
9) Quit

Tags: No tags