Professional Documents
Culture Documents
STUDENT INFORMATION
MANAGEMENT
SYSTEM
AIM:
To Implement JDBC (Java Database Connectivity) for a student information Management
System which involves establishing a connection between the Java application and the
database.
DESCRIPTION:
This project involves the implementation of a robust Student Information Management
System (SIMS) using Java Database Connectivity (JDBC) to establish a seamless connection
between the Java application and a MySQL database. The SIMS serves as a comprehensive
solution for educational institutions, enabling efficient storage, retrieval, and management of
student information.
Key Features:
User-Friendly GUI: The system boasts an intuitive Graphical User Interface (GUI) developed
using Swing, providing a seamless and user-friendly experience for administrators and end-
users.
JDBC Integration: Leveraging JDBC, the system establishes a secure and efficient
connection to a MySQL database, ensuring the seamless flow of data between the application
and the backend.
Addition of Student Records: Administrators can effortlessly add new student records to the
system by entering relevant details such as student ID, name, and course. The JDBC
integration ensures the immediate and accurate storage of this information in the database.
J. Bhavatharni (71812201030) 1
Viewing Student Records: The system facilitates the retrieval and display of student records
stored in the database. Users can easily view a list of students along with their respective
details, providing a comprehensive overview of the enrolled student body.
Data Validation and Error Handling: The system incorporates data validation mechanisms to
ensure the integrity of information entered. Additionally, robust error-handling procedures
are implemented to gracefully manage unforeseen issues, providing informative feedback to
users.
Scalability: The SIMS is designed with scalability in mind, capable of handling a growing
volume of student data and additional features as the educational institution evolves.
Security Measures: Security best practices are implemented to protect sensitive student
information. The JDBC connection is secured, and user authentication mechanisms are in
place to prevent unauthorized access to the system.
Expected Outcomes:
Efficient Data Management: A streamlined process for entering, retrieving, and managing
student information within the educational institution.
User Satisfaction: The user-friendly interface and seamless integration with the database
contribute to overall user satisfaction among administrators and end-users.
J. Bhavatharni (71812201030) 2
Secure and Reliable System: Implementation of security measures ensures the confidentiality
and integrity of student information, contributing to the reliability of the SIMS.
This project not only addresses the fundamental aspects of student information management
but also focuses on leveraging JDBC for a robust, scalable, and secure solution tailored to the
needs of educational institutions.
IMPLEMENTATION:
LoginFramme.java
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.GridLayout;
public class LoginFrame extends JFrame {
private JTextField usernameField;
private JPasswordField passwordField;
public LoginFrame() {
setTitle("Login");
setSize(300, 150);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
JLabel usernameLabel = new JLabel("Username:");
usernameField = new JTextField(15);
JLabel passwordLabel = new JLabel("Password:");
passwordField = new JPasswordField(15);
JButton loginButton = new JButton("Login");
loginButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String username =
usernameField.getText();
char[] passwordChars = passwordField.getPassword();
J. Bhavatharni (71812201030) 3
String password = new String(passwordChars);
// Validate the login credentials
if (validateLogin(username, password)) {
openHospitalManagement();
} else {
JOptionPane.showMessageDialog(LoginFrame.this, "Invalid username or
password",
J. Bhavatharni (71812201030) 4
public static void main(String[] args) {
SwingUtilities.invokeLater(LoginFrame::new);
}
}
Output:
appGUI.java
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
public AppGUI() {
J. Bhavatharni (71812201030) 5
JFrame frame = new JFrame("Student Database");
// Initialize labels
// Initialize buttons
J. Bhavatharni (71812201030) 6
searchButton = new JButton("Search");
addButton.addActionListener(this);
displayButton.addActionListener(this);
sortButton.addActionListener(this);
searchButton.addActionListener(this);
modifyButton.addActionListener(this);
panel.add(studentIdLabel);
panel.add(studentIdField);
panel.add(firstNameLabel);
panel.add(firstNameField);
panel.add(lastNameLabel);
panel.add(lastNameField);
panel.add(majorLabel);
panel.add(majorField);
panel.add(phoneLabel);
panel.add(phoneField);
panel.add(gpaLabel);
panel.add(gpaField);
panel.add(dobLabel);
panel.add(dobField);
J. Bhavatharni (71812201030) 7
panel.add(addButton);
panel.add(displayButton);
panel.add(sortButton);
panel.add(searchButton);
panel.add(modifyButton);
frame.add(panel);
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@Override
Connection conn;
try {
conn = db.getConnection();
try {
stmt = conn.createStatement();
J. Bhavatharni (71812201030) 8
} catch (SQLException e1) {
e1.printStackTrace();
if (e.getSource() == addButton) {
try {
stmt.executeUpdate(sql);
ex.printStackTrace();
try {
ResultSet rs = stmt.executeQuery(sql);
J. Bhavatharni (71812201030) 9
JOptionPane.showMessageDialog(null, new JScrollPane(table));
ex.printStackTrace();
switch (choice) {
default -> {
try {
ResultSet rs = stmt.executeQuery(sql);
J. Bhavatharni (71812201030) 10
ex.printStackTrace();
switch (choice) {
default -> {
String sql = "SELECT * FROM sdata WHERE " + column + " LIKE '%" +
searchTerm + "%'";
try {
ResultSet rs = stmt.executeQuery(sql);
J. Bhavatharni (71812201030) 11
// Create table to display student data
ex.printStackTrace();
String sql = "SELECT * FROM sdata WHERE student_id = '" + studentId + "'";
try {
ResultSet rs = stmt.executeQuery(sql);
if (rs.next()) {
String[] options = {"First Name", "Last Name", "Major", "Phone", "GPA", "Date
of Birth"};
switch (choice) {
J. Bhavatharni (71812201030) 12
case 2 -> column = "major";
default -> {
sql = "UPDATE sdata SET " + column + " = '" + newValue + "' WHERE
student_id = '" + studentId + "'";
stmt.executeUpdate(sql);
} else {
ex.printStackTrace();
Table.java
import java.sql.*;
J. Bhavatharni (71812201030) 13
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
columnNames.add(metaData.getColumnName(i));
while (rs.next()) {
row.add(rs.getObject(i));
rowData.add(row);
J. Bhavatharni (71812201030) 14
}
Main.java
import javax.swing.*;
window.pack();
window.setVisible(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
dbConnect.java
import java.sql.*;
Class.forName("com.mysql.cj.jdbc.Driver");
return conn;
J. Bhavatharni (71812201030) 15
}
SQL Query
Student_ID VARCHAR(10),
first_name VARCHAR(50),
last_name VARCHAR(50),
major VARCHAR(50),
Phone VARCHAR(15),
GPA DECIMAL(3,1),
DOB DATE
);
VALUES
J. Bhavatharni (71812201030) 16
OUTPUT:
J. Bhavatharni (71812201030) 17
RESULT:
Thus, we have successfully implemented the JDBC connectivity for the application of
Student information management System.
J. Bhavatharni (71812201030) 18