https://github.com/i3abghany/rheadb
A disk-oriented DBMS with in-memory caching, B+Tree indexing, and JDBC interface
https://github.com/i3abghany/rheadb
dbms jdbc sql
Last synced: 4 days ago
JSON representation
A disk-oriented DBMS with in-memory caching, B+Tree indexing, and JDBC interface
- Host: GitHub
- URL: https://github.com/i3abghany/rheadb
- Owner: i3abghany
- License: mit
- Created: 2021-05-12T15:00:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-13T21:22:04.000Z (over 3 years ago)
- Last Synced: 2025-03-26T18:34:02.274Z (6 months ago)
- Topics: dbms, jdbc, sql
- Language: Java
- Homepage:
- Size: 255 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RheaDB
A simple disk-based DBMS that supports simple SQL-like querying statements.
## What's currently implemented?
* Simple SQL-like queries
* Creating & dropping tables
* Deleting from tables
* Updating tables
* Simple selection queries
* Creating & deleting indices
* Disk-based storage
* In-memory buffer pool caching
* JDBC driver
* B+Tree indexing### JDBC driver loading and usage
The connection url passed to `DriverManager.getConnection()` must be in the
format `jdbc:rhea:DIR_PATH`, where `DIR_PATH` is the storage directory for the
database. It must be an existing directory.`Class.forName("RheaDB.JDBCDriver.JCDriver")` must be used so as to invoke the
`static` portion of the driver, and (hopefully) successfully connect to a
database instance.```java
import java.sql.*;public class ExampleProgram {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
Class.forName("RheaDB.JDBCDriver.JCDriver");
try (
Connection conn = DriverManager.getConnection("jdbc:rhea:/home/USER_NAME/dbdata");
Statement stmt = conn.createStatement();
stmt.executeQuery("CREATE TABLE FancyTable (id INT, name STRING, mass FLOAT);");
stmt.executeQuery("INSERT INTO FancyTable VALUES (1, \"Random Name\", 42.69);");
stmt.executeQuery("INSERT INTO FancyTable VALUES (2, \"Not Random Name\", 96.24);");
stmt.executeQuery("INSERT INTO FancyTable VALUES (3, \"Completely Random Name\", 3.1415);");
ResultSet rs = stmt.executeQuery("SELECT * FROM FancyTable;")
) {
while (rs.next())
System.out.println(rs.getInt(0) + " - " + rs.getString(1) + " - " +
rs.getFloat(2));
}
}
}
```