A Backend-Focused Java Application built using Java, JDBC, and MySQL, following a clean Layered Architecture.
Built to strengthen my Java Backend Development skills by implementing JDBC connectivity, clean software architecture, and database-driven application design.
This project is a console-based Hotel Management System developed to strengthen my understanding of Java Backend Development using JDBC and MySQL.
Instead of focusing only on implementing CRUD operations, this project emphasizes writing clean, maintainable, and well-structured backend code by following a Layered Architecture and Repository Pattern.
The application demonstrates how a Java application communicates with a relational database while maintaining a clear separation between presentation, business logic, and data access.
Throughout the development of this project, I focused on applying software engineering principles that are commonly used in backend applications.
- Create hotel reservations with automatic room allocation.
- View reservation details using Reservation ID.
- Vacate reservations while automatically updating room availability.
- Display only active reservations by excluding vacated records.
- Search rooms using guest names.
- Case-insensitive search.
- Partial name matching using Java Streams API.
- Automatically allocates available rooms.
- Updates room status after reservation.
- Restores room availability after checkout.
- Displays real-time room occupancy status.
- Password-protected database reset utility.
- Clears reservation history.
- Resets every room to AVAILABLE.
- Designed for development and testing.
- Clean console interface.
- Formatted tables and reports.
- User-friendly navigation.
- Utility-based screen transitions.
| Technology | Purpose |
|---|---|
| Java 26 | Core application development |
| JDBC | Database connectivity |
| MySQL | Relational database |
| Java Streams API | Searching and filtering |
| Collections Framework | Data handling |
| OOP | Application design |
| Layered Architecture | Separation of concerns |
| Repository Pattern | Data access abstraction |
- Object-Oriented Programming (OOP)
- Encapsulation
- Abstraction
- Interfaces
- Collections Framework
- Java Streams API
- Exception Handling
- JDBC Connectivity
- CRUD Operations
- Repository Pattern
- Service Layer
- Layered Architecture
- Separation of Concerns
- Database State Management
- MySQL
- SQL
- Primary Keys
- Auto Increment
- Timestamp Handling
- Relational Data Modeling
Through this project I gained practical experience in:
- Designing layered Java applications.
- Building reusable Service and Repository layers.
- Connecting Java applications with MySQL using JDBC.
- Managing application state through SQL operations.
- Writing clean and maintainable backend code.
- Using Java Streams for searching and filtering.
- Structuring projects similar to real-world backend applications.
More importantly, this project helped me understand why software architecture matters, rather than simply learning how to write Java code.
This project follows a Layered Architecture, where each layer has a clearly defined responsibility. This design improves maintainability, readability, testability, and allows future enhancements without affecting the entire application.
User
β
βΌ
Presentation Layer
(Main.java)
β
βΌ
Service Layer
(Business Logic & Workflow)
β
βΌ
Repository Layer
(JDBC Database Operations)
β
βΌ
MySQL Database
| Layer | Responsibility |
|---|---|
| Presentation Layer | Handles user interaction, menu navigation, input collection, and formatted console output. |
| Service Layer | Implements business rules, coordinates workflows, validates requests, and communicates with repositories. |
| Repository Layer | Executes SQL queries using JDBC and performs all database operations. |
| Database Layer | Stores room information, reservations, and reservation history. |
Every user request follows the same execution pipeline.
User
β
βΌ
Presentation Layer (Main)
β
βΌ
ReservationService
β
βΌ
Repository Layer
β
βΌ
JDBC
β
βΌ
MySQL Database
β
βΌ
Repository
β
βΌ
Service
β
βΌ
Presentation Layer
β
βΌ
Console Output
This workflow ensures that:
- The UI never executes SQL directly.
- Business rules remain inside the Service layer.
- Database access is isolated inside repositories.
- Responsibilities remain separated throughout the application.
Hotel-Management-System-Using-JDBC
β
βββ assets
β βββ banner.png
β βββ make-reservation.gif
β βββ view-reservation.gif
β βββ delete-reservation.gif
β βββ list-active-reservations.gif
β βββ get-room-number.gif
β βββ room-status.gif
β βββ clear-database.mp4
β
βββ database
β βββ hotelDB.sql
β βββ README.md
β
βββ lib
β βββ mysql-connector-j.jar
β
βββ src
β βββ app
β β βββ Main.java
β β
β βββ config
β β βββ database.properties.example
β β βββ database.properties (ignored by Git)
β β
β βββ domain
β β βββ Reservation.java
β β βββ Room.java
β β
β βββ repository
β β βββ ReservationRepository.java
β β βββ RoomRepository.java
β β
β βββ service
β β βββ ReservationService.java
β β βββ implementation
β β βββ ReservationServiceImpl.java
β β
β βββ util
β βββ ConsoleUtil.java
β βββ DBConnection.java
β βββ ResultsCarrier.java
β
βββ README.md
βββ LICENSE
βββ .gitignore
| Package | Description |
|---|---|
| app | Entry point of the application. Handles menus, user interaction, and console presentation. |
| config | Contains database configuration files and environment-specific settings. |
| domain | Contains entity classes such as Reservation and Room. |
| repository | Responsible for all JDBC operations and SQL execution. |
| service | Contains business logic and coordinates workflows between UI and repositories. |
| util | Shared helper classes for database connectivity, console utilities, and result wrappers. |
The application uses MySQL with three relational tables.
Stores information about every room available in the hotel.
| Column | Type | Description |
|---|---|---|
| roomNumber | INT | Unique room number |
| status | VARCHAR | AVAILABLE / OCCUPIED |
Stores all reservation records.
| Column | Type | Description |
|---|---|---|
| reservationId | INT | Auto-generated reservation ID |
| roomNumber | INT | Allocated room number |
| name | VARCHAR | Guest name |
| contactNumber | VARCHAR | Guest contact number |
| reservationDate | TIMESTAMP | Reservation creation timestamp |
Maintains reservation history after checkout.
Instead of permanently deleting reservation information, vacated reservations are tracked separately, allowing the application to display only active reservations while preserving historical records.
| Column | Type | Description |
|---|---|---|
| reservationId | INT | Vacated reservation ID |
| vacatedDate | TIMESTAMP | Checkout timestamp |
Several architectural decisions were intentionally taken while building this project:
- Separation of concerns through Layered Architecture.
- Repository Pattern to isolate database operations.
- JDBC used directly to strengthen backend fundamentals.
- Console-based UI to focus entirely on backend development.
- Configuration moved to external properties instead of hardcoding credentials.
- Utility classes created for reusable functionality and cleaner code organization.
These decisions helped create a maintainable codebase while providing hands-on experience with real-world backend application design.
The following demonstrations showcase the primary workflows of the application and how each feature interacts with the backend.
Automatically allocates the next available room, stores the reservation in the database, and updates the room status to OCCUPIED.
Retrieve complete reservation information using the generated Reservation ID.
Vacates a reservation and automatically changes the corresponding room status back to AVAILABLE.
Displays only active reservations by excluding vacated reservations using the vacatedUsers table.
Uses the Java Streams API to perform a case-insensitive search and return the allocated room number(s).
Displays the current occupancy status of every room in the hotel.
For development and testing purposes, the application includes a password-protected database reset utility.
This utility:
- Clears reservation records.
- Clears vacated reservation history.
- Restores every room to the AVAILABLE state.
- Resets the application to its initial state.
β‘οΈ Watch Database Reset Demo
Every feature demonstrated above follows the same backend workflow.
User
β
βΌ
Presentation Layer
(Main.java)
β
βΌ
Reservation Service
(Business Logic Layer)
β
βββββββββββββ΄ββββββββββββ
βΌ βΌ
ReservationRepository RoomRepository
β β
βββββββββββββ¬ββββββββββββ
βΌ
JDBC
β
βΌ
MySQL Database
This architecture keeps:
- SQL isolated inside the Repository layer.
- Business rules inside the Service layer.
- User interaction inside the Presentation layer.
As a result, each layer has a single responsibility, making the project easier to maintain and extend.
Follow the steps below to set up and run the project locally.
Before running the application, ensure the following software is installed:
- Java JDK 26 (or later)
- MySQL Server
- MySQL Connector/J
- Visual Studio Code (or any Java IDE)
git clone https://github.com/ateeburrahaman3/Hotel-Management-System-Using-JDBC.git
cd Hotel-Management-System-Using-JDBCOpen your MySQL server.
Import the SQL script located at:
database/hotelDB.sql
The script automatically creates:
- hotelDB
- roomsT
- reservationT
- vacatedUsers
and inserts the initial room records required by the application.
Open:
src/config/database.properties
Update the following values according to your local MySQL installation:
db.url=jdbc:mysql://localhost:3306/hotelDB
db.user=your_username
db.password=your_password
admin.password=your_admin_passwordCompile and execute:
src/app/Main.java
The application launches with an interactive console interface.
====================================================
HOTEL MANAGEMENT SYSTEM
====================================================
1. Make Reservation
2. View Reservation
3. Delete Reservation
4. List Active Reservations
5. Search Room by Guest Name
6. Room Status
0. Exit
| Resource | Description |
|---|---|
| assets/ | Banner, GIF demonstrations, and walkthrough videos |
| database/ | SQL initialization script and setup guide |
| src/ | Complete application source code |
| lib/ | MySQL JDBC Driver |
This project is intentionally built without Maven or Gradle to strengthen understanding of core Java project structure and manual dependency management.
Configuration is externalized using:
src/config/database.properties
which stores:
- Database URL
- Database Username
- Database Password
- Admin Password
The sample configuration is provided in:
src/config/database.properties.example
allowing anyone to configure the project without exposing sensitive credentials.
While this project successfully demonstrates the fundamentals of Java backend development using JDBC, there are several enhancements that could further improve its scalability, maintainability, and production readiness.
- Implement transaction management for multi-step database operations.
- Add centralized logging using a logging framework.
- Improve exception handling with custom exception classes.
- Introduce foreign key constraints for stronger database integrity.
- Externalize all application configuration and environment variables.
- Reservation update functionality.
- Room categories and pricing management.
- Billing and invoice generation.
- Reservation history and reporting.
- Advanced search and filtering.
- User authentication and role-based authorization.
- Migrate to Spring Boot.
- Replace raw JDBC with Spring Data JPA / Hibernate.
- Build RESTful APIs.
- Add Unit and Integration Testing using JUnit.
- Dockerize the application.
- Implement CI/CD using GitHub Actions.
Developing this project significantly strengthened my understanding of backend application development.
Throughout the implementation, I gained practical experience in:
- Designing applications using Layered Architecture.
- Applying the Repository Pattern.
- Separating Presentation, Service, and Repository responsibilities.
- Connecting Java applications with MySQL using JDBC.
- Writing SQL queries for real-world CRUD operations.
- Managing application state through relational databases.
- Building reusable utility classes.
- Using Java Streams for efficient data processing.
- Structuring backend projects for maintainability and scalability.
More importantly, this project helped me understand why clean software architecture matters, rather than simply learning how to write Java code.
This project was built with the following objectives:
- Strengthen Java backend fundamentals.
- Gain hands-on experience with JDBC.
- Understand how layered applications are structured.
- Practice clean coding principles.
- Build a portfolio-ready backend project.
- Establish a strong foundation before moving to Spring Boot and enterprise backend development.
Hi, I'm Ateeb Ur Rahaman.
I'm an Electronics and Communication Engineering graduate with a strong interest in Java Backend Development, Software Engineering, and Artificial Intelligence.
I enjoy building projects that help me understand how real-world backend systems are designedβfrom database interaction and software architecture to scalable application development.
My current learning roadmap includes:
- Spring Boot
- REST APIs
- Hibernate
- Docker
- Microservices
- Generative AI
This project represents an important milestone in my journey toward becoming a Backend Developer.
I'm always open to connecting with developers, recruiters, and anyone interested in backend development.
π§ Email
ateeburrahaman3@gmail.com
π LinkedIn
https://www.linkedin.com/in/ateeb-ur-rahaman/
π GitHub
https://github.com/ateeburrahaman3
This project is licensed under the MIT License.
You are welcome to use, study, modify, and learn from this project in accordance with the terms of the license.
For more information, see the LICENSE file.
If you found this project useful or interesting, please consider giving it a β on GitHub.
Your feedback, suggestions, and contributions are always welcome.
Java Backend Development β’ Spring Boot β’ REST APIs β’ Docker β’ Generative AI
"Every project is another step toward becoming a better software engineer."






