This is a simple Hotel Management System implemented in Java using JDBC to interact with a MySQL database.
- JDK installed
- MySQL server installed and running
- MySQL Connector/J library in the classpath
- Clone the repository:
git clone https://github.com/akashdgowda/Hotel_Management_JDBC.git
- Open the project in your preferred Java IDE.
- Make sure to have the MySQL Connector/J library in your classpath.
- Update the database connection details in
HotelManagement.java
:private static final String url = "jdbc:mysql://localhost:3306/hotel_db"; private static final String username = "root"; private static final String password = "yourPassword";
- Run the
HotelManagement
class. - The system will display a menu with the following options:
HOTEL MANAGEMENT SYSTEM
- Reserve a room
- View Reservation
- Get Room Number
- Update Reservation
- Delete Reservation
- Exit Choose an option:
- Reserve a room: Add a new reservation with guest name, room number, and contact number.
- View Reservation: Display a list of all current reservations.
- Get Room Number: Retrieve the room number for a given reservation ID and guest name.
- Update Reservation: Modify the details of an existing reservation.
- Delete Reservation: Remove a reservation based on the reservation ID.
The system assumes a MySQL database with the following table structure:
CREATE TABLE reservations (
reservation_id INT PRIMARY KEY AUTO_INCREMENT,
guest_name VARCHAR(255) NOT NULL,
room_number INT NOT NULL,
contact_number VARCHAR(15) NOT NULL,
reservation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Feel free to adapt the database schema according to your requirements.
This project uses the MySQL database for data storage. Special thanks to the MySQL and Java communities.