A console-based StudentRecordManager built with Java and MySQL, demonstrating Object-Oriented Programming (OOP) principles and database integration through JDBC.
- Add new student records
- View all students
- View a student by ID
- Update existing student details
- Delete a student record
- Clean separation of concerns using DAO pattern (Model, DAO, DB connection, and UI layers)
- Language: Java (JDK 17+)
- Database: MySQL
- Connectivity: JDBC (MySQL Connector/J)
StudentManagementSystem/
├── src/
│ ├── Student.java # Model class (student entity)
│ ├── DBConnection.java # Handles MySQL connection
│ ├── StudentDAO.java # CRUD operations (Data Access Object)
│ └── Main.java # Console menu / entry point
├── schema.sql # Database schema + sample data
├── README.md
└── .gitignore
git clone https://github.com/<your-username>/StudentRecordManager.git
cd StudentRecordManagerRun the schema script in MySQL:
mysql -u root -p < schema.sqlOpen src/DBConnection.java and update these fields to match your MySQL setup:
private static final String DB_URL = "jdbc:mysql://localhost:3306/student_db";
private static final String DB_USER = "root";
private static final String DB_PASSWORD = "your_password";Download mysql-connector-j (a .jar file) from the official MySQL site and add it to your classpath.
# Compile
javac -d bin src/*.java
# Run (include the MySQL connector jar in the classpath)
java -cp "bin:mysql-connector-j-x.x.x.jar" MainOn Windows, replace the : in the classpath with ;:
java -cp "bin;mysql-connector-j-x.x.x.jar" Main=====================================
StudentRecordManager
=====================================
----------- MENU -----------
1. Add Student
2. View All Students
3. View Student by ID
4. Update Student
5. Delete Student
6. Exit
-----------------------------
Enter your choice:
- Implementing CRUD operations using JDBC and PreparedStatements (to prevent SQL injection)
- Applying OOP concepts (encapsulation, separation of concerns) in a real project
- Structuring a Java application using the DAO design pattern
- Connecting a Java application to a MySQL database