A lightweight Java database management system that simulates core DBMS concepts including table creation, page-based record storage, serialized file persistence, record selection, operation tracing, missing-page recovery, and bitmap indexing.
java database dbms bitmap-indexing file-storage serialization data-structures algorithms recovery query-processing
DBMS Engine is an academic database systems project built to demonstrate how relational database engines manage records internally. The system stores tables as serialized Java objects, splits records across fixed-size pages, supports multiple selection methods, tracks execution traces, recovers missing records from metadata, and accelerates conditional queries using bitmap indexes.
Traditional database systems hide storage management, indexing, and recovery behind high-level SQL interfaces. This project implements simplified versions of those internal mechanisms to better understand how a DBMS organizes data, persists pages, handles missing storage files, and improves query performance using indexes.
- Create database tables with custom column names
- Insert records into fixed-size pages
- Persist tables, pages, and indexes using Java serialization
- Select all records from a table
- Select records by page and record position
- Select records using column-value conditions
- Maintain execution traces for inserts, selects, indexing, validation, and recovery
- Validate missing records when page files are deleted
- Recover missing pages using stored table metadata
- Create bitmap indexes on selected columns
- Retrieve bitmap strings for specific column values
- Perform indexed selection using bitmap intersection
flowchart TD
A["DBApp API"] --> B["Table"]
B --> C["Page"]
B --> D["BitmapIndex"]
B --> E["FileManager"]
E --> F["Serialized Table Files"]
E --> G["Serialized Page Files"]
E --> H["Serialized Index Files"]
- Java
- Object-Oriented Programming
- Java Serialization
- File I/O
- ArrayList
- HashMap
- Bitmap indexing
- Page-based storage simulation
The project separates responsibilities across five main components:
DBApp: public API layer used to create tables, insert records, select data, validate records, recover records, and create indexes.Table: manages table metadata, records, pages, traces, recovery logic, and index-aware selection.Page: stores a fixed number of records and performs page-level record filtering.FileManager: handles persistence by storing and loading tables, pages, and bitmap indexes as serialized files.BitmapIndex: maps column values to bitmap strings and supports bitmap intersection for indexed queries.
ArrayList<String[]>stores table records and page records.HashMap<String, String>maps indexed values to bitmap strings.- Page allocation places records into fixed-size pages.
- Linear scans are used for non-indexed selections.
- Bitmap intersection is used to combine indexed query conditions.
- Recovery calculates missing pages using record position and page size.
Clone the repository:
git clone https://github.com/basmalaallam/DBMS-Engine.git
cd DBMS-EngineCompile the project:
javac -d bin src/DBMS/*.javaRun the demo:
java -cp bin DBMS.DBAppString[] columns = {"id", "name", "major", "semester", "gpa"};
DBApp.createTable("student", columns);
DBApp.insert("student", new String[]{"1", "stud1", "CS", "5", "0.9"});
DBApp.insert("student", new String[]{"2", "stud2", "BI", "7", "1.2"});
ArrayList<String[]> result = DBApp.select(
"student",
new String[]{"major"},
new String[]{"CS"}
);
DBApp.createBitMapIndex("student", "major");
ArrayList<String[]> indexedResult = DBApp.selectIndex(
"student",
new String[]{"major"},
new String[]{"CS"}
);src/
`-- DBMS/
|-- DBApp.java # Public API and demo runner
|-- Table.java # Table metadata, selection, tracing, recovery, indexing
|-- Page.java # Fixed-size page storage and page-level selection
|-- FileManager.java # Serialization-based persistence layer
`-- BitmapIndex.java # Bitmap index implementation
- Add JUnit tests for insert, select, recovery, and indexing
- Replace string-based records with typed schemas
- Add input validation and custom exceptions
- Support update and delete operations
- Add SQL-like query parsing
- Improve bitmap storage using
BitSet - Add Maven or Gradle build configuration
- Separate demo code from the main DBMS API
- Implemented core DBMS storage concepts from scratch
- Practiced object-oriented design in Java
- Built a file-backed persistence layer using serialization
- Implemented page-based storage and record recovery
- Designed bitmap indexing for faster query filtering
- Strengthened understanding of data structures, algorithms, and database internals

