A desktop-based Library Management System built with Java Swing, JDBC, and MySQL. It uses a layered architecture to keep the code organized and maintainable while providing a simple GUI for managing book records.
- Add books through a GUI form
- View all books in a table (JTable)
- Delete books by ID
- Backend support for fetching and updating books
- Basic input validation in the service layer
- Java (Swing)
- JDBC
- MySQL
- SQL
Library-Management-System/
│
├── src/
│ ├── dao/ → database interaction (JDBC)
│ ├── dto/ → data objects (Book model)
│ ├── service/ → business logic & validation
│ ├── ui/ → Swing GUI
│ └── mysql-connector-j-9.x.x.jar
│
├── .gitignore
└── README.md
The project is structured into layers to keep responsibilities separate:
- DTO – represents the data (book entity)
- DAO – handles database queries
- Service – applies validation and business rules
- UI – interacts with the user via Swing
CREATE DATABASE rnsitdb;
USE rnsitdb;
CREATE TABLE books (
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(100),
author VARCHAR(100),
quantity INT
);-
Make sure MySQL is running
-
Update DB credentials in
dao/LibraryDAOImpl.java -
Compile:
javac -d . -cp src/mysql-connector-j-9.x.x.jar src/*/*.java
-
Run:
java -cp ".;src/mysql-connector-j-9.x.x.jar" ui.LibraryUI
- Complete update & search functionality in UI
- Improve layout (replace null layout with proper managers)
- Add authentication
- Extend to issue/return system
- Structuring Java applications using layered architecture
- Connecting Java applications to MySQL using JDBC
- Building a basic GUI using Swing
- Handling classpaths and project structure in Java
Kanishka Agarwal




