Mock Library Database using MySql and Java
This project is a relational database system for a library, implemented with a Java GUI and SQL backend. It allows users to interact with the library database by:
- Searching for books by ISBN, title, or author.
- Adding new members to the library system.
- Validating existing members.
The application integrates both the user interface and backend logic into a single Java file for simplicity and submission purposes.
Note: The original database server is no longer operational. Users must set up their own MySQL server and update the connection details in the code to use this application.
- Member Login: Validates member IDs to access the system.
- Book Search: Allows users to search books using multiple criteria (ISBN, author, title).
- Member Registration: Enables new members to register by providing their details.
- Dynamic Tables: Displays search results in a table format.
- Error Handling: Informs users about invalid inputs, such as incorrect IDs or dates.
- Database Schema: Contains tables for members, books, authors, and book locations.
- Queries: Includes SQL queries for efficient data retrieval and management.
- Triggers and Views: Utilizes SQL triggers and views to enhance database functionality.
-
Java Application (
Lab10Geisterfer.java
):- Implements the GUI and backend logic.
- Interacts with the database using JDBC.
- Includes error-handling mechanisms for user input validation.
-
SQL Files:
relationalSchema.sql
: Defines the relational schema for the database.queryTriggerView.sql
: Includes SQL queries, triggers, and views.activity.sql
: Populates the database with sample data.LoadLib.sql
: Prepares the database with initial configurations.
-
Python Utility (
createDataDump.py
):- Used for creating backups or managing database dumps.
- Java Development Kit (JDK): Version 11 or higher.
- MySQL Server: Required to set up your own database server.
- Python: Required for
createDataDump.py
(optional).
-
Set Up MySQL Server:
- Install MySQL Server on your system.
- Create a new database.
-
Import the Database Schema:
- Open
relationalSchema.sql
in a MySQL client and execute the script to set up the schema.
- Open
-
Load Initial Data:
- Run
activity.sql
andLoadLib.sql
to populate the database with sample data.
- Run
-
Update Database Connection Details:
- In the
SQLRelay
class ofLab10Geisterfer.java
, update the following variables with your database connection details:static final String DB_URL = "jdbc:mysql://<your-database-url>:3306/<your-database-name>"; static final String USER = "<your-username>"; static final String PASS = "<your-password>";
- In the
-
Compile and Run the Java Application:
javac Lab10Geisterfer.java java Lab10Geisterfer