75% found this document useful (4 votes)
5K views

Library Management Project

This document describes a library management system project created by Satyabrat Dwivedy for his class XII exams. The project uses a MySQL database backend to store user, book, and transaction data, and was built using Netbeans IDE. Key features of the application include user login, adding new books and student entries, and functions for librarians to issue and return books. The project aims to help automate record keeping tasks for school libraries.

Uploaded by

Drezzing Gaming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
75% found this document useful (4 votes)
5K views

Library Management Project

This document describes a library management system project created by Satyabrat Dwivedy for his class XII exams. The project uses a MySQL database backend to store user, book, and transaction data, and was built using Netbeans IDE. Key features of the application include user login, adding new books and student entries, and functions for librarians to issue and return books. The project aims to help automate record keeping tasks for school libraries.

Uploaded by

Drezzing Gaming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 17

JAWAHAR NAVODAYA VIDYALAYA

ANGUL
INFORMATICS PRACTICES
PROJECT
2019-20

LIBRARY MANAGEMENT

Submitted to Submitted by
MISS DOLLY NAYAK Name : SATYABRATA DWIVEDY

(P.G.T I.P) Hall Ticket No. :


ACKNOWLEDGEMENT

It is my humble pleasure to acknowledge my deep


sense of gratitude to Mr. Rudra Prasad Sahoo , Principal
JNV ANGU ,providing me laboratory facilities to carry out
this project.
I express my sincere thanks to Miss Dolly Nayak,
PGT I.P for his valuable support, constant help and
guidance at each and every stage, without which it
wouldn’t have been possible to complete this project.

Name: Satyabrat Dwivedy


Class : XII Sc.
CERTIFICATE

This is to certify that


__________________________
of class XII has created an application(project)
named “LIBRARY MANAGEMENT” . He has
successfully prepared this project report in the
I.P laboratory of JAWAHAR NAVODAYA VIDYALAYA
ANGUL. This project may be considered as partial
fulfillment of AISSCE 2019-20 conducted by
the Central Board of Secondary Education,
Bhubaneswar region.

Date: Signature of the student

HALL TICKET NO:-

INTERNAL EXAMINER EXTERNAL EXAMINER


PREFACE
Library Management is an application which can be
used in a library of a school to maintain the records
of its books and the students. This application's front
end is created using Netbeans IDE 8.0.2 version and
its backend is created using MySql.

The application accepts user details which are


stored at the back end and also takes a Unique
Admission Number to every student who access the
library. List of books which are already stored in the
database is displayed to the user to choose the book.
This application allows the registered librarian to
issue a book to the student and take back .

The application uses Database Connectivity to


connect front end and back end.

We hope that the present application will cater
the needs of librarian and students as a matter
of   fact,   we   would   feel   rewarded   if   this
application  is found helpful to the users .All the
attempts   have   been   made   to   make   this
application error free.

Front end : Frame1


Frame2
Code for “LOGIN” button:
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

String username = jTextField1.getText();


String password = jPasswordField1.getText();
String Username = "",Password = "";

if(username.isEmpty() )
JOptionPane.showMessageDialog(this,"Username is not entered");
else
if(password.isEmpty())
JOptionPane.showMessageDialog(this,"Password is not entered");
else
{
try
{
Class.forName("java.sql.DriverManager");
Connection con = (Connection)

DriverManager.getConnection("jdbc:mysql://localhost:3306/libman","root","password
");
Statement stmt = (Statement)con.createStatement();
String query = "Select username,password from account where
username='"+username+"';";
ResultSet rs=stmt.executeQuery(query);
if(rs.next())
{
Username = rs.getString("username");
Password = rs.getString("password");
}

}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
if (username.equals(Username) && password.equals(Password))
{
this.setVisible((false));
mainpage a = new mainpage();
a.setVisible(true);
}
else
{
JOptionPane.showMessageDialog(this,"either your username or password
is wrong");
jTextField1.setText(null);
jPasswordField1.setText(null);
}
}

}
Code for “CREATE” button:

private void jButton5ActionPerformed(java.awt.event.ActionEvent


evt) {

String name = jTextField1.getText();


String username = jTextField2.getText();
String password = jPasswordField1.getText();
String repassword = jPasswordField2.getText();
String mobile = jTextField3.getText();

if(name.isEmpty() )
JOptionPane.showMessageDialog(this,"Name is not entered");
else
if (username.isEmpty())
JOptionPane.showMessageDialog(this, "Username is not entered");
else
if(password.isEmpty())
JOptionPane.showMessageDialog(this,"Password is not entered");
else
if (repassword.isEmpty())
JOptionPane.showMessageDialog(this,"You have to re-enter your
password");
else
if (mobile.isEmpty())
JOptionPane.showMessageDialog(this,"Mobile number is not entered");
else
{
if(password.equals(repassword))
{
try
{
Class.forName("java.sql.DriverManager");
Connection con = (Connection)

DriverManager.getConnection("jdbc:mysql://localhost:3306/libman","root","password
");
Statement stmt = (Statement) con.createStatement();
String query = "insert into account values
('"+name+"','"+username+"','"+mobile+"','"+password+"');";
stmt.executeUpdate(query);

JOptionPane.showMessageDialog(this," your account has been successfully


created,WELCOME to library management system");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
}
else
JOptionPane.showMessageDialog(this,"password did not match");
}
}
Code for “O.K” button in ‘add a book’ panel :

private void jButton5ActionPerformed(java.awt.event.ActionEvent


evt) {

String accno =jTextField1.getText();


String book = jTextField2.getText();
String author = jTextField3.getText();
String cost = (jTextField4.getText());

if(accno.isEmpty() )
JOptionPane.showMessageDialog(this,"Accession no. is not entered");
else
if (book.isEmpty())
JOptionPane.showMessageDialog(this, "Book name is not entered");
else
if(author.isEmpty())
JOptionPane.showMessageDialog(this,"Author name is not entered");
else
if (cost.isEmpty())
JOptionPane.showMessageDialog(this,"price of the book is not entered");
else
{
try
{
Class.forName("java.sql.DriverManager");
Connection con = (Connection)

DriverManager.getConnection("jdbc:mysql://localhost:3306/libman","root","password
");
Statement stmt = (Statement) con.createStatement();
String query1 = "insert into books values
('"+accno+"','"+book+"','"+author+"','"+cost+"');";
String query2 = "insert into issue values('0','"+accno+"','0','1');";
stmt.executeUpdate(query1);
stmt.executeUpdate(query2);
JOptionPane.showMessageDialog(this," thank you , a new book has been
successfully added");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
}
}

Code for “O.K” button in ‘New Entry’ Panel :

private void
jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
String admnno = jTextField5.getText();
String studentname = jTextField6.getText();

try
{
Class.forName("java.sql.DriverManager");
Connection con = (Connection)

DriverManager.getConnection("jdbc:mysql://localhost:3306/libman","root","password
");
Statement stmt = (Statement) con.createStatement();
String query = "insert into student values
('"+admnno+"','"+studentname+"');";
stmt.executeUpdate(query);

JOptionPane.showMessageDialog(this," new student has been successfully


enrolled. ");

int a =JOptionPane.showConfirmDialog(this,"Do you want to add more


students");

}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}

Code for “FINISH” button :


private void finishActionPerformed(java.awt.event.ActionEvent
evt) {

String accno = jTextField7.getText();


String admno = jTextField5.getText();
String isdate ,rsdate ;
String book = jTextField8.getText();
if (jRadioButton1.isSelected())
{
isdate = jTextField9.getText();

try
{
Class.forName("java.sql.DriverManager");
Connection con = (Connection)

DriverManager.getConnection("jdbc:mysql://localhost:3306/libman","root","password
");
Statement stmt = (Statement) con.createStatement();
String query1 = "insert into issue values
('"+admno+"','"+accno+"','"+isdate+"','0');";
String query2 = "select rdate from issue where accno = '"+accno+"'; ";
ResultSet rs = stmt.executeQuery(query2);

if(rs.last())

{
String date = rs.getString("rdate");

if(date.equals("0"))
JOptionPane.showMessageDialog(this,"this book has already been
issued to someone else");
else

{
stmt.executeUpdate(query1);
JOptionPane.showMessageDialog(this,"a book has been issued to " +
jTextField6.getText());
}

}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
}
else if (jRadioButton2.isSelected())
{
rsdate = jTextField9.getText();

try
{
Class.forName("java.sql.DriverManager");
Connection con = (Connection)

DriverManager.getConnection("jdbc:mysql://localhost:3306/libman","root","password
");
Statement stmt = (Statement) con.createStatement();
String query = "update issue set rdate = '"+rsdate+"' where admnno =
'"+admno+"' and accno = '"+accno+"';";
stmt.executeUpdate(query);

JOptionPane.showMessageDialog(this,"Mr."+jTextField6.getText()+" has
returned a book named "+jTextField8.getText());
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
}
DefaultTableModel model = (DefaultTableModel) jTable2.getModel();
int rows = model.getRowCount();
if(rows > 0 )
{
for(int i = 0 ;i < rows ;i++)
model.removeRow(0);
}

Backend :

Table : “BOOKS”
Table : “STUDENT”

Table : “ACCOUNTS”

You might also like