Library Management System
Library Management System
(UGC AUTONOMUS)
(Approved by AICTE, Affiliated to JNTU, Kukatpally, Hyderabad)
Kandlakoya, Medchal, Hyderabad.
2023-2024
1
MICRO PROJECT REPORT
ON
LIBRARY MANAGEMENT SYSTEM
Submitted to the CMR Institute of Technology in partial fulfilment of the requirement
for the award of the Laboratory of OOP’S THROUGH JAVA of
II-B. Tech. I-Semester in
DEPARTMENT OF CSE(AI&ML)
Submitted by
A.Sritharth (22R01A66D3)
Sakshith (22R01A66F7)
Lahari (22R01A66G4)
2
CMR INSTITUTE OF TECHNOLGY
(UGC AUTONOMUS)
(Approved by AICTE, Affiliated to JNTU, Kukatpally, Hyderabad)
Kandlakoya, Medchal Road, Hyderabad
2022-2023
DEPARTMENT OF CSE(AI&ML)
CERTIFICATE
This is to certify that a micro project entitled with “LIBRARY MANAGEMENT SYSTEM”
is being
Submitted by
A.Sritharth (22R01A66D3)
Sakshith (22R01A66F7)
Lahari (22R01A66G4)
In partial fulfilment of the requirement for award of the OOP THROUGH JAVA Lab of II-B.
Tech I- Semester in CSM towards a record of a bonafide work carried out under our guidance
and supervision.
Signature Of Faculty Signature Of Coordinator Signature Of HOD
Mr. P. Niranjan Reddy Dr .K. Ruben Raju Mr. P. Pavan Kumar
(Assistant Professor) ( Assistant Professor) (Head Of Department)
3
ACKNOWLEDGEMENT
Principal and Mr. P. Pavan Kumar, Head of the Department, Dept of Freshman
Engineering, CMR Institute of Technology for their inspiration and valuable guidance during
Freshman Engineering department, CMR Institute of Technology for his constant guidance,
We express our thanks to all staff members and friends for all the help and
Finally, we are very much thankful to our parents and relatives who guided directly
A.Sritharth (22R01A66D3)
Sakshith (22R01A66F7)
Lahari (22R01A66G4)
4
INDEX
5
What is JAVA?
Java is an object-oriented language similar to C++, but with advanced and simplified
features. Java is free to access and can run on all platforms.
The features of Java are as follows:
Simple: Java has made life easier by removing all the complexities such as pointers,
operator overloading as you see in C++ or any other programming language.
Object-oriented: Everything is considered to be an “object” which possess some state,
behaviour and all the operations are performed using these objects.
Secured: All the code is converted in bytecode after compilation, which is not
readable by a human. and java does not use an explicit pointer and run the programs
inside the sandbox to prevent any activities from untrusted sources. It enables to
develop virus-free, tamper-free systems/applications.
What is MySQL?
MySQL is an open-source relational database management system that works on many
platforms. It provides multi-user access to support many storage engines and is backed by
Oracle. So, you can buy a commercial license version from Oracle to get premium support
services.
The features of MySQL are as follows:
Ease of Management – The software very easily gets downloaded and also uses an
event scheduler to schedule the tasks automatically.
Robust Transactional Support – Holds the ACID (Atomicity, Consistency, Isolation,
Durability) property, and also allows distributed multi-version support.
Comprehensive Application Development – MySQL has plugin libraries to embed
the database into any application. It also supports stored procedures, triggers,
functions, views and many more for application development. Refer to RDS Tutorial
to understand Amazon’s RDBMS.
6
Abstract
5. Digital Integration: To adapt to the digital era, LMS integrates digital resources
seamlessly. Librarians can manage electronic books, articles, and multimedia
content within the system, ensuring a holistic approach to resource management
and catering to the diverse needs of the user community.
7
7. Security Measures: The project prioritizes the implementation of robust security
measures, including user authentication and access controls. This ensures the
confidentiality and integrity of library data, safeguarding both the collection and
user information.
8
Introduction
Libraries have been essential repositories of knowledge, serving as hubs for information
seekers, researchers, and enthusiasts for centuries. In the contemporary digital landscape, the
role of libraries is evolving, necessitating innovative solutions to enhance their efficiency and
relevance. The Library Management System (LMS) Project is a response to this evolving
landscape, offering a comprehensive digital framework to streamline and modernize
traditional library operations.
In the face of expanding collections, diverse formats, and increasing user expectations, the
need for an integrated system to manage library resources becomes paramount. The LMS
Project seeks to address the challenges faced by libraries in manual cataloging, circulation,
and resource management by introducing a user-friendly, automated solution. By leveraging
technology, this project aims to optimize library workflows, improve user experiences, and
empower librarians with advanced tools for better decision-making.
The primary objectives of the Library Management System Project are to automate key
library processes, create a seamless user experience, and integrate digital resources into the
library ecosystem. The project recognizes the importance of accessibility and user
engagement, emphasizing the development of an intuitive interface that caters to both
librarians and patrons. Through the incorporation of cutting-edge technologies such as
barcode scanning, RFID, and a centralized database, the LMS Project aims to minimize
manual errors, enhance accuracy, and provide real-time access to information.
Furthermore, the project acknowledges the transition of libraries into digital spaces and
addresses the need for managing electronic resources effectively. By facilitating the
integration of digital content, the LMS Project ensures that libraries can cater to the
information needs of a diverse and tech-savvy user base. The inclusion of reporting and
analytics tools equips librarians with insights into resource usage, enabling informed
decisions on collection development and resource allocation.
In essence, the Library Management System Project is not just a technological upgrade; it is a
strategic initiative to redefine the role of libraries in the digital age. By embracing
automation, user-centric design, and digital integration, this project seeks to transform
libraries into dynamic hubs that not only preserve the essence of traditional knowledge
repositories but also adapt seamlessly to the evolving information landscape. Through the
implementation of the LMS, libraries can position themselves as modern, efficient, and
accessible institutions, fostering a culture of continuous learning and information
dissemination.
9
System Requirements
Library Management System is one of the most popular projects which is created using Java.
So, in this article, I will show you how to create this project using the following system
requirements.
System Requirements
To execute the below project, you will need the following business requirements:
MySQL Community Server
MySQL JDBC Connector
Java
NetBeans IDE
rs2xml.jar
The rs2xml jar is used to display the data in a table format. So, once you create a project in
Eclipse IDE, you have to import the rs2xml jar and JDBC connector JAR into the project.
To do that, right-click on the project, choose Build Path -> Configure Build Path. In the
dialog box, which opens up, choose Add External JARs, and add the JAR files. Once added,
click on Apply and Close. Refer below
Tables Considered
Now, for this particular project, I have considered three tables, which are:
Users -> This table consists of the columns {UID, Username, Password, Admin}
Books-> The book’s table consists of the columns {BID, Book name, Price, Genre}
Issue -> This table consists of the columns {IID, UID, BID, Issue_Date, Period,
Return_Date, Fine}
Alright, so now that the Initial set is done, and I have told you the schema of tables, let us get
started.
Front End -
IDE - Net Beans
Functions -
1. Login Page
2. Books Available
3. Staff Details
10
4. Add Books
5. Remove Books
6. Add Staff
7. Remove Staff
Back End -
MySql
Tables -
1. Admin Table
2. Books Table
3. Staff Table
Important packages:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException;
Libraries imported:
JDK (Java Development Kit)
My SQL Connector
11
Architecture
12
Source Code
In NetBeans IDE to create a project we use JFrames by this we can create design and code for
project.
First we create Home Page for Library Management System:
1. HomePage.java
public class MainLayer extends javax.swing.JFrame {
public MainLayer() {
initComponents();
@SuppressWarnings("unchecked")
anb.setVisible(true);
this.setVisible(false);
r.setVisible(true);
this.setVisible(false);
ib.setVisible(true);
this.setVisible(false);
rb.setVisible(true);
this.setVisible(false);
ibs.setVisible(true);
this.setVisible(false);
13
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
bd.setVisible(true);
this.setVisible(false);
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(AddNewBook.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
java.util.logging.Logger.getLogger(AddNewBook.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
java.util.logging.Logger.getLogger(AddNewBook.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
java.util.logging.Logger.getLogger(AddNewBook.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new MainLayer().setVisible(true);
});}
14
2. Registration of Student:
Connection con;
Statement stmt;
ResultSet rs;
String query;
public RegisterStudent() {
initComponents();
rb.setVisible(true);
this.setVisible(false);
if(t1.getText().equals(""))
else if(t2.getText().equals(""))
else if(a1.getText().equals(""))
else
connect();
try
stmt.executeUpdate(query);
catch(SQLException e)
if(e.getErrorCode()==1062)
15
JOptionPane.showMessageDialog(this,"StudentId is a primary key, duplicate entry is not allowed\nIt should be unique");
else
JOptionPane.showMessageDialog(this,"connection error");
if(c1.getSelectedItem()=="Science")
c2.removeAllItems();
c2.addItem("Select Class");c2.addItem("FYBScCS");c2.addItem("SYBScCS");c2.addItem("TYBScCS");
if(c1.getSelectedItem()=="Arts")
c2.removeAllItems();
c2.addItem("Select Class");c2.addItem("FYBA");c2.addItem("SYBA");c2.addItem("TYBA");
if(c1.getSelectedItem()=="Commerce")
c2.removeAllItems();
c2.addItem("Select Class");c2.addItem("FYBCom");c2.addItem("SYBCom");c2.addItem("TYBCom");
mn.setVisible(true);
this.setVisible(false);
mn.setVisible(true);
this.setVisible(false);
16
bd.setVisible(true);
this.setVisible(false);
ib.setVisible(true);
this.setVisible(false);
ibs.setVisible(true);
this.setVisible(false);
/**
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
17
java.util.logging.Logger.getLogger(RegisterStudent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new RegisterStudent().setVisible(true);
});
try
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/pankaj?useSSL=false&autoReconnect=true","root","8543998287");
stmt=con.createStatement();
catch(Exception e)
JOptionPane.showMessageDialog(this,"connection error");
try
con.close();
catch(Exception e)
{}
18
3. IssueBooks.java:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import java.text.SimpleDateFormat;
import java.util.Date;
Connection con;
Statement stmt;
ResultSet rs;
String query;
String checkAvailability,SName,Address,SStream,SClass;
public IssueBook() {
initComponents();
if(t2.getText().equals(""))
else
try
connect();
rs=stmt.executeQuery(query);
rs.next();
if(t6.getText().equals("YES"))
stmt.executeUpdate(query);
19
JOptionPane.showMessageDialog(this,"Book with id = "+t3.getText()+" has been issued to "+t2.getText());
stmt.executeUpdate(query);
if(t6.getText().equals("NO"))
if(t6.getText().equals(""))
t4.setText("");
t1.setText("");
t2.setText("");
t3.setText("");
t6.setText("");
disconnect();
catch(SQLException e)
if(e.getErrorCode()==1062)
JOptionPane.showMessageDialog(this,"A student can only get a single book from library at a time ");
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
20
} catch (InstantiationException ex) {
java.awt.EventQueue.invokeLater(new Runnable() {
new IssueBook().setVisible(true);
});
try
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/pankaj?useSSL=false&autoReconnect=true","root","8543998287");
stmt=con.createStatement();
catch(Exception e)
System.out.println(e);
JOptionPane.showMessageDialog(this,"connection error");
try
con.close();
catch(Exception e)
{}
}}
21
4. IssuedBooks.java:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Connection con;
Statement stmt;
ResultSet rs;
String query;
try
connect();
rs=stmt.executeQuery(query);
DefaultTableModel model=(DefaultTableModel)table.getModel();
model.setRowCount(0);
while(rs.next())
Object[] row =
{rs.getString("StudentId"),rs.getString("StudentName"),rs.getString("BookId"),rs.getString("BookName"),rs.getString("Address"),rs.getStri
ng("IssueDate")};
model.addRow(row);
catch(Exception e)
java.awt.EventQueue.invokeLater(new Runnable() {
new IssuedBooks().setVisible(true);
22
}
});
5. AddNewBook.java:
import com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
Connection con;
Statement stmt;
String query;
if(txt2.getText().equals(""))
else if(txt3.getText().equals(""))
else if(txt3.getText().equals(""))
else
try
connect();
stmt.executeUpdate(query);
disconnect();
txt2.setText("");
txt3.setText("");
23
txt4.setText("");
c3.setSelectedIndex(0);
c4.removeAllItems();
c4.addItem("Select Class");
catch(SQLException e)
if(e.getErrorCode()==1062)
else
JOptionPane.showMessageDialog(this,"connection error");
6. .BookDetails.java:
public class BookDetails extends javax.swing.JFrame {
Connection con;
Statement stmt;
ResultSet rs;
String query;
String BId,Bname,Bauthor,strm,cls,avl;
try
connect();
rs=stmt.executeQuery(query);
DefaultTableModel model=(DefaultTableModel)table.getModel();
model.setRowCount(0);
while(rs.next())
BId=rs.getString("BookID");
Bname=rs.getString("BookName");
Bauthor=rs.getString("Author");
strm=rs.getString("Stream");
cls=rs.getString("Class");
avl=rs.getString("Available");
24
Object[] row = {BId,Bname,Bauthor,strm,cls,avl};
model.addRow(row);
disconnect();
catch(Exception e)
System.out.println(e);
c2.enable();
if(c1.getSelectedItem()=="Science")
c2.removeAllItems();
c2.addItem("Select Class");c2.addItem("FYBScCS");c2.addItem("SYBScCS");c2.addItem("TYBScCS");
if(c1.getSelectedItem()=="Arts")
c2.removeAllItems();
c2.addItem("Select Class");c2.addItem("FYBA");c2.addItem("SYBA");c2.addItem("TYBA");
if(c1.getSelectedItem()=="Commerce")
c2.removeAllItems();
c2.addItem("Select Class");c2.addItem("FYBCom");c2.addItem("SYBCom");c2.addItem("TYBCom");
DefaultTableModel model=(DefaultTableModel)table.getModel();
model.setRowCount(0);
String txt=txt1.getText();
if(txt.equals(""))
System.out.println("");
else
try
25
{
connect();
rs=stmt.executeQuery(query);
while(rs.next())
BId=rs.getString("BookID");
Bname=rs.getString("BookName");
Bauthor=rs.getString("Author");
strm=rs.getString("Stream");
cls=rs.getString("Class");
avl=rs.getString("Available");
model.addRow(row);
disconnect();
catch(Exception e)
System.out.println(e);
7. ReturnBook.java:
public class ReturnBook extends javax.swing.JFrame {
Connection con;
Statement stmt;
ResultSet rs;
String query;
try
connect();
rs=stmt.executeQuery(query);
int i=0;
while(rs.next())
26
{
i++;
t2.setText(rs.getString("StudentName"));
t3.setText(rs.getString("BookId"));
t4.setText(rs.getString("BookName"));
t5.setText(rs.getString("IssueDate"));
disconnect();
if(i==0)
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
catch(Exception e)
System.out.println(e);
t6.setText(format.format(date));
try
connect();
rs=stmt.executeQuery(query);
if(rs.next())
query+=t2.getText()+"','"+t3.getText()+"','"+t4.getText()+"','"+t5.getText()+"','"+t6.getText()+"');";
stmt.executeUpdate(query);
stmt.executeUpdate(query);
stmt.executeUpdate(query);
disconnect();
27
JOptionPane.showMessageDialog(this,"Thank you! visit again");
t4.setText("");
t1.setText("");
t2.setText("");
t3.setText("");
t5.setText("");
else
catch(SQLException e)
JOptionPane.showMessageDialog(this,e);
} }
28
OUTPUT
Home page:
Registration:
Issue book:
29
Return
Book:
30
Add New Book:
Book Details:
31
Issued Books:
This brings us to the end of our article on Library Management System Project in Java.
32
CONCLUSION
In conclusion, the Library Management System (LMS) Project implemented in Java serves as
a crucial step towards modernizing and optimizing traditional library operations. The project
successfully addresses key challenges faced by libraries, providing a comprehensive digital
solution that enhances efficiency, accessibility, and user experience.
Through the incorporation of features such as user-friendly interfaces, cataloging and
classification, circulation management, and digital resource integration, the LMS Project
significantly streamlines library workflows. The project leverages technologies like barcode
scanning and RFID, ensuring accurate tracking and management of both physical and digital
resources.
The introduction of reporting and analytics tools empowers librarians to make informed
decisions, promoting data-driven collection development and resource allocation. Security
measures, user authentication, and access controls safeguard sensitive information, ensuring
the integrity of both the library's collection and user data.
The project's adaptability to diverse needs, such as multi-lingual support, mobile accessibility,
and integration with external systems, positions it as a versatile solution capable of catering
to a broad user base. The inclusion of features like reservation systems, interlibrary loan
management, and fine management further enhances the overall functionality and user
satisfaction.
As libraries transition into the digital age, the LMS Project not only preserves the essence of
traditional knowledge repositories but also embraces innovation, making libraries dynamic
hubs for information dissemination. The systematic organization of resources, efficient
circulation processes, and seamless integration of digital content redefine the role of libraries
in the contemporary information landscape.
In essence, the Library Management System Project in Java is not merely a technological
upgrade; it represents a strategic initiative to propel libraries into the future. By combining
technological advancements with user-centric design principles, the project sets the stage for
libraries to remain relevant, accessible, and indispensable in an ever-evolving digital world.
A Library Management System Project in Java is one of the various systems developed
that has numerous functionalities that meet the current requirements of the present-day
library system.
To enhance it, you can add features like RFID, SMS to remind users of the return date,
and others.
Java has many features that can be explored to create such wonderful programs.
33
References
https://www.upgrad.com/blog/library-management-system-project-in-java/
https://www.edureka.co/blog/library-management-system-project-in-java
https://copyassignment.com/library-management-system-project-in-java/
34