The Menu Driven Student Management System is a Java CLI application developed for the purpose of understanding JDBC and SQL. This project demonstrates how to use JDBC to perform CRUD operations on a MySQL database in a practical, interactive manner.
- Add Student: Insert a new student's details into the database.
- Display Students: List all students.
- Search Student: Find a student by ID.
- Remove Student: Delete a student by ID.
- Update Student: Modify an existing student's details.
- Java: Core programming language.
- JDBC: Java Database Connectivity for interfacing with MySQL.
- MySQL: Database system used for storing student records.
- Java JDK 8 or higher
- MySQL 5.7 or higher
- JDBC Driver for MySQL
- Clone the repository:
git clone https://github.com/yourusername/MenuDrivenStudentManagement-JDBC.git
- Configure the Database: Run the following SQL commands in MySQL:
-- Create the StudentDB database
CREATE DATABASE StudentDB;
-- Select the StudentDB database for use
USE StudentDB;
-- Create the students table
CREATE TABLE students (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100),
age INT,
sgpa DOUBLE,
phone_number VARCHAR(15)
);
- Update JDBC Configuration: Modify the JDBC connection details in your Java code:
String url = "jdbc:mysql://localhost:3306/StudentDB"; String username = "yourUsername"; String password = "yourPassword";
- Compile and Run:
javac com/StudentManagementCRUD/Main.java java com.StudentManagementCRUD.Main
After running the application, you will see a menu with the following options:
- Add Student: Input details to add a student.
- Display Students: View all student records.
- Search Student: Locate a student by ID.
- Remove Student: Delete a student by ID.
- Update Student: Edit an existing student's details.
- Exit: Close the application.
This project is intended to provide hands-on experience with JDBC and SQL, illustrating how to perform common database operations using Java.
- Input validation for fields.
- Error handling for database operations.
- Additional search filters.
- GUI integration for a better user experience.