Modern desktop app to manage books, students, and lending workflows — built with Java Swing and MySQL.
Effortless adds, issues/returns with due dates and fines, quick availability checks, and one-click database backup/restore.
- Add and view books and students
- Issue and submit books with due dates and fine calculation
- Search availability by code or title
- Admin login and first-run DB initialization
- Backup and restore the database from the UI
- Java JDK 8+ (JAVA_HOME set)
- MySQL Server 8+ running locally on port 3306
- MySQL Connector/J (provided:
mysql-connector-j-8.0.33.jar) - Windows users: ensure
mysqldumpandmysqlare on PATH for Backup/Restore
-
Create the database schema
- Start MySQL Server
- Create schema:
CREATE DATABASE library;
-
(Option A) First run initializes tables automatically
- The app creates required tables on startup if missing.
(Option B) Initialize with SQL files
- Base:
mysql -u root -p library < lib.sql - Optional updates:
mysql -u root -p library < update_library_schema.sql
-
Build and run
javac -cp ".;mysql-connector-j-8.0.33.jar" *.java
java -cp ".;mysql-connector-j-8.0.33.jar" LibraryGUI
Tip (Windows): create run.bat:
@echo off
java -cp ".;mysql-connector-j-8.0.33.jar" LibraryGUI
pause
Default database connection (see LibraryGUI.java):
- URL:
jdbc:mysql://localhost:3306/library - User:
root - Password:
Shubh@1008
You can change these in one place in LibraryGUI.java. Some panels currently open direct connections; for consistency, consider refactoring all panels to use LibraryGUI.getConnection().
Admin (GUI) credentials (from LoginPanel.java):
- Username:
admin - Password:
Shubh1008
Security note: credentials are hardcoded for demo. For production, use environment variables or a config file and avoid exposing passwords on the command line (see Backup/Restore).
Library Management/
AddBookPanel.java
AddStudentPanel.java
BackupPanel.java
CheckAvailabilityPanel.java
IssueBookPanel.java
LibraryGUI.java
LibraryManager.java (optional CLI utility)
LoginPanel.java
MainMenuPanel.java
SubmitBookPanel.java
ViewBooksPanel.java
ViewStudentsPanel.java
lib.sql
update_library_schema.sql
mysql-connector-j-8.0.33.jar
- Driver not found:
com.mysql.cj.jdbc.Driver→ ensure the connector jar is on the classpath - Access denied for user 'root'@'localhost' → verify the password or update
DB_PASSWORD - Backup/Restore fails (exit code) → ensure MySQL
binis on PATH somysqldump/mysqlare found - Port conflicts → confirm MySQL is on
3306or adjustDB_URL
- This codebase uses simple JDBC without a connection pool. For production, consider pooling (e.g., HikariCP) and moving credentials to environment variables or a config file.
- If distributing to multiple PCs, consider packaging with a small installer and bundling the JRE.
Made with ❤️ using Java, and MySQL.