IP PROJECT
Database Connectivity
CERTIFICATE
This project on Student
Information System using
database connectivity in JAVA
has been satisfactorily
completed and submitted by
Shubhankar, studying in St.
Michaels High School in
class12 E.
Board Roll No.:
_________________
Teachers Signature
Date:
ACKNOWLEDGEMENT
I express my gratitude towards every individual
under whose able guidance and support, I could
take up the project on Student Information
Record and complete it successfully.
I would like to thank my IP teacher, Mr. Ashutosh
Kumar who gave all the information required for
the project and guided us throughout. I also
extend my heartfelt gratitude towards my
parents and friends who supported me
throughout the project. THANK YOU!
CONTENTS
S.No.
TOPIC
Pg.No.
Introduction
MySQL
Student Record
Database
Netbeans IDE
Adding JDBC Connector
10
Log-In Page
11
Home Page
14
Add Page
19
Delete Page
23
10
Update Page
31
11
Show Page
39
12
Conclusion
43
13
Bibliography
44
INTRODUCTION
Few years back, all information management
records used to be manual. As a result, wrong
counting or miscalculations created a lot of
problem. The development of a computerized
information record system changed this. There
was a decrease in paperwork and time was
saved, also increasing accuracy and efficiency. In
the following project on Student Information
Record, Netbeans IDE was selected as the front
end and MySQL as the back end. The application
is protected by a password, thus ensuring
security.
INTRODUCTION
On entering the correct log-in ID and the
password in the Log-In Page, the Home Page
appears where there are buttons leading to
other windows for adding, deleting, updating
and showing the entered records. The java
project is linked to the Student Record
database in MySQL server. The various
buttons direct the server to add, delete or
update the records using the Admission
Number as a reference, while the Show button
shows all the pre-existing records in the
database.
MySQL
MySQL STARTING WINDOW
STUDENT RECORD
DATABASE
THE TABLE IS CREATED USING MySQL
NETBEANS IDE
NETBEANS IDE STARTING WINDOW
ADDING JDBC
CONNECTOR
THE mysql-connector-java IS ADDED UNDER THE LIBRARIES
DESIGN FOR THE
LOG-IN PAGE
LOG-IN PAGE OF THE APP
COMPONENTS OF
LOG-IN PAGE
head [ jLabel ]
Font : Tempus Sans ITC 36 Bold
Horizontal alignment : Center
Text : LOG-IN
l1 [ jLabel ]
Font : Goudy Old Style 24 Bold
Text : Log-In ID:
l2 [ jLabel ]
Font : Goudy Old Style 24 Bold
Text : Password:
tf1 [ jTextField ]
pf1 [ jPasswordField ]
b1 [ jButton ]
Font : Gadugi 24 Bold
Text : ENTER
CODE FOR THE
LOG-IN PAGE
import javax.swing.*;
private void
b1ActionPerformed(java.awt.event.ActionEvent evt)
{
String uid = tf1.getText();
String pwd = new String (pf1.getPassword());
if(pwd.equals("password")) {
JOptionPane.showMessageDialog(null,"Welcome
"+uid);
this.setVisible(false);
Home_Page X = new Home_Page();
X.setVisible(true);
}
else {
JOptionPane.showMessageDialog(null,"Invalid
Password Try Again");
tf1.setText("");
pf1.setText("");
}
}
DESIGN FOR THE
HOME PAGE
HOME PAGE OF THE APP
COMPONENTS OF
HOME PAGE
head1 [ jLabel ]
Font : Ravie 36 Bold
Text : Student
head2 [ jLabel ]
Font : Ravie 36 Bold
Text : Information Record
info [ jLabel ]
Font : Tempus Sans ITC 24 Bold
Text : Choose an action:
b1 [ jButton ]
Font : Gadugi 24 Bold
Text : ADD
b2 [ jButton ]
Font : Gadugi 24 Bold
Text : UPDATE
COMPONENTS OF
HOME PAGE
b3 [ jButton ]
Font : Gadugi 24 Bold
Text : DELETE
b4 [ jButton ]
Font : Gadugi 24 Bold
Text : SHOW
b5 [ jButton ]
Font : Gadugi 24 Bold
Text : EXIT
welcome [ jTextArea ]
Font : Monospaced 13 Plain
Text : Welcome to the app for
the
CODE FOR THE
HOME PAGE
import javax.swing.*;
private void
b1ActionPerformed(java.awt.event.ActionEven
t evt) {
this.setVisible(false);
Add X = new Add();
X.setVisible(true);
}
private void
b3ActionPerformed(java.awt.event.ActionEven
t evt) {
this.setVisible(false);
Update X = new Update();
X.setVisible(true);
}
CODE FOR THE
HOME PAGE
private void
b2ActionPerformed(java.awt.event.ActionEven
t evt) {
this.setVisible(false);
Delete X = new Delete();
X.setVisible(true);
}
private void
b4ActionPerformed(java.awt.event.ActionEven
t evt) {
this.setVisible(false);
Show X = new Show();
X.setVisible(true);
}
private void
b5ActionPerformed(java.awt.event.ActionEven
t evt) {
System.exit(0);
}
DESIGN FOR THE
ADD PAGE
ADD PAGE OF THE APP
COMPONENTS OF
ADD PAGE
head [ jLabel ]
Font : Tempus Sans ITC 36 Bold
Text : ADD RECORD
l1 [ jLabel ]
Font : Goudy Old Style 24 Bold
Text : NAME:
l2 [ jLabel ]
Font : Goudy Old Style 24 Bold
Text : ADMNO:
l3 [ jLabel ]
Font : Goudy Old Style 24 Bold
Text : CLASS:
l4 [ jLabel ]
Font : Goudy Old Style 24 Bold
Text : SECTION:
l5 [ jLabel ]
Font : Goudy Old Style 24 Bold
Text : ROLL:
COMPONENTS OF
ADD PAGE
tf1 [ jTextField
tf2 [ jTextField
tf3 [ jTextField
tf4 [ jTextField
tf5 [ jTextField
b1 [ jButton ]
]
]
]
]
]
Font : Gadugi 24 Bold
Text : ADD
b2 [ jButton ]
Font : Gadugi 24 Bold
Text : REFRESH
b3 [ jButton ]
Font : Gadugi 24 Bold
Text : BACK
CODE FOR THE
ADD PAGE
import javax.swing.*;
private void
b1ActionPerformed(java.awt.event.ActionEvent evt)
{
String uid = tf1.getText();
String pwd = new String (pf1.getPassword());
if(pwd.equals("password")) {
JOptionPane.showMessageDialog(null,"Welcome
"+uid);
this.setVisible(false);
Home_Page X = new Home_Page();
X.setVisible(true);
}
else {
JOptionPane.showMessageDialog(null,"Invalid
Password Try Again");
tf1.setText("");
pf1.setText("");
}
}
DESIGN FOR THE
DELETE PAGE
DELETE PAGE OF THE APP
COMPONENTS OF
DELETE PAGE
head [ jLabel ]
Font : Tempus Sans ITC 36 Bold
Text : DELETE RECORD
info [ jLabel ]
Font : Tempus Sans ITC 18 Bold
Text : Enter Admission No. of
l0 [ jLabel ]
Font : Goudy Old Style 24 Bold
Text : ADMNO:
tf0 [ jTextField ]
b1 [ jButton ]
Font : Gadugi 24 Bold
Text : VERIFY
b2 [ jButton ]
Font : Gadugi 24 Bold
Text : DELETE
Enabled : False
COMPONENTS OF
DELETE PAGE
b3 [ jButton ]
Font : Gadugi 24 Bold
Text : REFRESH
b3 [ jButton ]
Font : Gadugi 24 Bold
Text : BACK
tf0 [ jTextField ]
jPanel1 [ jPanel ]
tf1
tf2
tf3
tf4
tf5
[
[
[
[
[
jLabel
jLabel
jLabel
jLabel
jLabel
]
]
]
]
]
COMPONENTS OF
DELETE PAGE
jPanel1 [ jPanel ]
l1 [ jLabel ]
l2 [ jLabel ]
Font : Tahoma 11 Plain
Text : CLASS:
l4 [ jLabel ]
Font : Tahoma 11 Plain
Text : ADMNO:
l3 [ jLabel ]
Font : Tahoma 11 Plain
Text : NAME:
Font : Tahoma 11 Plain
Text : SECTION:
l5 [ jLabel ]
Font : Tahoma 11 Plain
Text : ROLL:
CODE FOR THE
DELETE PAGE
import javax.swing.*;
import java.sql.*;
private void
b1ActionPerformed(java.awt.event.ActionEvent evt) {
String qr = tf0.getText();
try{
Class.forName("java.sql.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost/pr
oject","root","password");
Statement stmt = con.createStatement();
String query = "select * from student_record where
adm_no"+qr+";";
ResultSet rs = stmt.executeQuery(query);
String t1 = rs.getString(1);
int t2 = rs.getInt(2);
int t3 = rs.getInt(3);
String t4 = rs.getString(4);
int t5 = rs.getInt(5);
CODE FOR THE
DELETE PAGE
tf1.setText(t1);
tf2.setText(t2+"");
tf3.setText(t3+"");
tf4.setText(t4);
tf5.setText(t5+"");
b2.setEnabled(true);
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,"Error"
);
}
}
CODE FOR THE
DELETE
PAGE
private void
b2ActionPerformed(java.awt.event.ActionEvent
evt) {
String t1 = tf0.getText();
try{
Class.forName("java.sql.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://local
host/project","root","password");
Statement stmt = con.createStatement();
String query;
query = "delete from student_record where
adm_no="+t1+";";
ResultSet rs = stmt.executeQuery(query);
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,"Error");
}
CODE FOR THE
DELETE PAGE
b2.setEnabled(false);
tf1.setText("");
tf2.setText("");
tf3.setText("");
tf4.setText("");
tf5.setText("");
}
private void
b3ActionPerformed(java.awt.event.ActionEvent evt) {
tf0.setText("");
tf1.setText("");
tf2.setText("");
tf3.setText("");
tf4.setText("");
tf5.setText("");
}
private void
b4ActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
Home_Page X = new Home_Page();
X.setVisible(true);
}
DESIGN FOR THE
UPDATE PAGE
UPDATE PAGE OF THE APP
COMPONENTS OF
UPDATE PAGE
head [ jLabel ]
Font : Tempus Sans ITC 36 Bold
Text : UPDATE RECORD
info [ jLabel ]
Font : Tempus Sans ITC 18 Bold
Text : Enter Admission No. of
l0 [ jLabel ]
Font : Goudy Old Style 24 Bold
Text : ADMNO:
tf0 [ jTextField ]
b1 [ jButton ]
Font : Gadugi 24 Bold
Text : VERIFY
b2 [ jButton ]
Font : Gadugi 24 Bold
Text : UPDATE
Enabled : False
COMPONENTS OF
UPDATE PAGE
b3 [ jButton ]
Font : Gadugi 24 Bold
Text : REFRESH
b3 [ jButton ]
Font : Gadugi 24 Bold
Text : BACK
tf0 [ jTextField ]
jPanel1 [ jPanel ]
tf1 [ jTextField ]
tf2 [ jTextField ]
Enabled : false
tf4 [ jTextField ]
Enabled : false
tf3 [ jTextField ]
Enabled : false
Enabled : false
tf1 [ jTextField ]
Enabled : false
COMPONENTS OF
UPDATE PAGE
jPanel1 [ jPanel ]
l1 [ jLabel ]
l2 [ jLabel ]
Font : Tahoma 11 Plain
Text : CLASS:
l4 [ jLabel ]
Font : Tahoma 11 Plain
Text : ADMNO:
l3 [ jLabel ]
Font : Tahoma 11 Plain
Text : NAME:
Font : Tahoma 11 Plain
Text : SECTION:
l5 [ jLabel ]
Font : Tahoma 11 Plain
Text : ROLL:
CODE FOR THE
UPDATE PAGE
import javax.swing.*;
import java.sql.*;
private void b1ActionPerformed(java.awt.event.ActionEvent
evt) {
String qr = tf0.getText();
try{
Class.forName("java.sql.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost/project","
root","password");
Statement stmt = con.createStatement();
String query = "select * from student_record where
adm_no"+qr+";";
ResultSet rs = stmt.executeQuery(query);
String t1 = rs.getString(1);
int t2 = rs.getInt(2);
int t3 = rs.getInt(3);
String t4 = rs.getString(4);
int t5 = rs.getInt(5);
CODE FOR THE
UPDATE PAGE
tf1.setText(t1);
tf2.setText(t2+"");
tf3.setText(t3+"");
tf4.setText(t4);
tf5.setText(t5+"");
b2.setEnabled(true);
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,"Error"
);
}
}
CODE FOR THE
UPDATE PAGE
private void
b2ActionPerformed(java.awt.event.ActionEvent evt) {
String t1 = tf0.getText();
try{
Class.forName("java.sql.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost/pr
oject","root","password");
Statement stmt = con.createStatement();
String query;
query = "update student_record set name="+t1+"
class="+t2+" section="+t3+" roll="+t4+";";
ResultSet rs = stmt.executeQuery(query);
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,"Error");
}
CODE FOR THE
UPDATE PAGE
b2.setEnabled(false);
tf1.setText("");
tf2.setText("");
tf3.setText("");
tf4.setText("");
tf5.setText("");
}
private void b3ActionPerformed(java.awt.event.ActionEvent
evt) {
tf0.setText("");
tf1.setText("");
tf2.setText("");
tf3.setText("");
tf4.setText("");
tf5.setText("");
}
private void b4ActionPerformed(java.awt.event.ActionEvent
evt) {
this.setVisible(false);
Home_Page X = new Home_Page();
X.setVisible(true);
}
DESIGN FOR THE
SHOW PAGE
SHOW PAGE OF THE APP
COMPONENTS OF
SHOW PAGE
head [ jLabel ]
Font : Tempus Sans ITC 36 Bold
Horizontal alignment : Center
Text : LOG-IN
tab1 [ jTable ]
Model :
Rows : 0
Columns : 5
1. Name
2. Adm.No.
3. Class
4. Section
5. Roll
b1 [ jButton ]
Font : Gadugi 24 Bold
Text : SHOW
b2 [ jButton ]
Font : Gadugi 24 Bold
Text : BACK
CODE FOR THE
SHOW PAGE
import javax.swing.*;
import java.sql.*;
private void
b1ActionPerformed(java.awt.event.ActionEvent
evt) {
DefaultTableModel model =
(DefaultTableModel) tab1.getModel();
try{
Class.forName("java.sql.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://loc
alhost/project","root","password");
Statement stmt = con.createStatement();
String query = "select * from student_record;";
ResultSet rs = stmt.executeQuery(query);
while(rs.next()) {
String t1 = rs.getString(1);
int t2 = rs.getInt(2);
int t3 = rs.getInt(3);
String t4 = rs.getString(4);
int t5 = rs.getInt(5);
model.addRow(new Object[]{t1,t2,t3,t4,t5});
}
CODE FOR THE
SHOW PAGE
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null
,"Error");
}
}
private void
b2ActionPerformed(java.awt.event.Ac
tionEvent evt) {
this.setVisible(false);
Home_Page X = new Home_Page();
X.setVisible(true);
}
CONCLUSION
With the advancement of technology, our
information systems became computerized. In
schools, the student information record stores
every data of every student who has ever
enrolled in the school, whether a present
student or an alumnus. This project helped me
to understand the functioning of such
information systems, what happens on the
screen and what happens inside. This was a
knowledge gaining project and it brought
several new facts. The experience of taking up
the project and completing it successfully was
truly an amazing experience.
BIBLIOGRAPHY
www.google.com
www.wikipedia.com
Netbeans-8.0.2
Mysql