0% found this document useful (0 votes)
39 views34 pages

Library Management System

This document describes a student project to develop a library management system. A group of 4 students - A. Sritharth, D. Siva Rama Krishna, Sakshith, and Lahari - submitted the project to partially fulfill the requirements for their laboratory course in Object Oriented Programming Through Java at CMR Institute of Technology. The project was developed under the guidance of faculty member Mr. P. Niranjan Reddy. The document includes an abstract that outlines the goals of developing a digital library management system to automate processes, improve the user interface and experience, facilitate resource cataloging and circulation management, and integrate digital resources and administrative tools.

Uploaded by

Rama Krishna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views34 pages

Library Management System

This document describes a student project to develop a library management system. A group of 4 students - A. Sritharth, D. Siva Rama Krishna, Sakshith, and Lahari - submitted the project to partially fulfill the requirements for their laboratory course in Object Oriented Programming Through Java at CMR Institute of Technology. The project was developed under the guidance of faculty member Mr. P. Niranjan Reddy. The document includes an abstract that outlines the goals of developing a digital library management system to automate processes, improve the user interface and experience, facilitate resource cataloging and circulation management, and integrate digital resources and administrative tools.

Uploaded by

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

CMR INSTITUTE OF TECHNOLOGY

(UGC AUTONOMUS)
(Approved by AICTE, Affiliated to JNTU, Kukatpally, Hyderabad)
Kandlakoya, Medchal, Hyderabad.

2023-2024

Department of Computer Science And Engineering


(Artificial Intelligence And Machine Learning)

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)

D. Siva Rama Krishna (22R01A66E4)

Sakshith (22R01A66F7)

Lahari (22R01A66G4)

Under the Guidance of


Mr. P. NIRANJAN REDDY
(Assistant Professor ,Department of CSE- AI & ML)

CMR INSTITUTE OF TECHNOLGY


(UGC AUTONOMUS)
(Approved by AICTE, Affiliated to JNTU, Kukatpally, Hyderabad)
Kandlakoya, Medchal Road, Hyderabad
2022-2023

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)

D. Siva Rama Krishna (22R01A66E4)

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

We are extremely grateful to Dr. M. Janga Reddy, Director, Dr. B. Satyanaryana,

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

the entire duration.

We are extremely thankful to our Mr. P. Niranjan Reddy, Assistant Professor,

Freshman Engineering department, CMR Institute of Technology for his constant guidance,

encouragement and moral support throughout the project.

We express our thanks to all staff members and friends for all the help and

coordination extended in bringing out this micro project successfully in time.

Finally, we are very much thankful to our parents and relatives who guided directly

or indirectly for successful completion of the project.

A.Sritharth (22R01A66D3)

D. Siva Rama Krishna (22R01A66E4)

Sakshith (22R01A66F7)

Lahari (22R01A66G4)

4
INDEX

Contents Pg. No.


1. What is java 6
2. What is MySQL 6
3. Abstract 7
4. Introduction 9
5. System Requirements 10
6. Architecture 12
7. Source Code 13
8. Output 29
9. Conclusion 33
10. References 34

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

The Library Management System (LMS) Project aims to revolutionize traditional


library operations by introducing a comprehensive digital framework that automates key
processes, facilitates seamless information access, and enhances overall efficiency. This
project addresses the challenges faced by libraries in managing diverse resources and
streamlines administrative tasks, providing librarians and patrons with a user-friendly and
integrated platform.
 Key Objectives:
1. Automation of Library Processes: The LMS project automates fundamental
library processes, including cataloging, circulation, and resource management. By
incorporating barcode technology and a centralized database, the system
minimizes manual interventions, reducing errors and improving accuracy.

2. User-Centric Interface: The project prioritizes the development of a user-centric


interface, ensuring accessibility and ease of use for both librarians and patrons.
Intuitive navigation and clear functionalities enhance the overall user experience,
encouraging increased engagement with library resources.

3. Resource Cataloging and Organization: LMS facilitates the systematic


cataloging and organization of various resources such as books, journals, and
multimedia. The system supports metadata management, making it easier to
categorize and retrieve information, contributing to efficient library resource
utilization.

4. Circulation Management: The project introduces a circulation management


module, enabling patrons to check in and check out materials effortlessly. LMS
also manages overdue items, fines, and holds, optimizing the circulation workflow
and enhancing user satisfaction.

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.

6. Administrative Tools: LMS provides administrators with advanced reporting and


analytics tools. These tools empower librarians to analyze usage patterns, track
popular resources, and make informed decisions regarding resource allocation and
collection development.

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.

The Library Management System Project is poised to bring about a transformative


shift in the way libraries operate, promoting efficiency, accessibility, and adaptability to
technological advancements. Through the seamless integration of digital tools and
streamlined processes, this project aims to contribute significantly to the modernization and
optimization of library services, aligning them with the evolving needs of the information
age.

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.

Library Management System Project Code


For your better understanding, I have divided the code into the following functions and I will
be explaining you function-wise:

 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")

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

AddNewBook anb=new AddNewBook();

anb.setVisible(true);

this.setVisible(false);

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

RegisterStudent r=new RegisterStudent();

r.setVisible(true);

this.setVisible(false);

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

IssueBook ib=new IssueBook();

ib.setVisible(true);

this.setVisible(false);

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

ReturnBook rb=new ReturnBook();

rb.setVisible(true);

this.setVisible(false);

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

IssuedBooks ibs=new IssuedBooks();

ibs.setVisible(true);

this.setVisible(false);

13
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {

BookDetails bd=new BookDetails();

bd.setVisible(true);

this.setVisible(false);

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<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.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(AddNewBook.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(AddNewBook.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(AddNewBook.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (javax.swing.UnsupportedLookAndFeelException 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() {

public void run() {

new MainLayer().setVisible(true);

});}

14
2. Registration of Student:
Connection con;

Statement stmt;

ResultSet rs;

String query;

public RegisterStudent() {

initComponents();

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

ReturnBook rb=new ReturnBook();

rb.setVisible(true);

this.setVisible(false);

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

if(t1.getText().equals(""))

JOptionPane.showMessageDialog(this,"Please enter StudentId");

else if(t2.getText().equals(""))

JOptionPane.showMessageDialog(this,"Please enter Student Name");

else if(c1.getSelectedItem()=="Select Stream")

JOptionPane.showMessageDialog(this,"Please select stream");

else if(c2.getSelectedItem()=="Select Class")

JOptionPane.showMessageDialog(this,"Please select class");

else if(a1.getText().equals(""))

JOptionPane.showMessageDialog(this,"Please enter Address");

else

connect();

try

query="insert into student values('"+t1.getText()+"','"+t2.getText()+"','"+c1.getSelectedItem()+"','"+c2.getSelectedItem()


+"','"+a1.getText()+"');";

stmt.executeUpdate(query);

JOptionPane.showMessageDialog(this,"Thank you "+t1.getText()+"\nYou are registered now");

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");

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

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");

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

MainLayer mn=new MainLayer();

mn.setVisible(true);

this.setVisible(false);

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

MainLayer mn=new MainLayer();

mn.setVisible(true);

this.setVisible(false);

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

BookDetails bd=new BookDetails();

16
bd.setVisible(true);

this.setVisible(false);

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

IssueBook ib=new IssueBook();

ib.setVisible(true);

this.setVisible(false);

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

IssuedBooks ibs=new IssuedBooks();

ibs.setVisible(true);

this.setVisible(false);

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<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.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(RegisterStudent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(RegisterStudent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(RegisterStudent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

17
java.util.logging.Logger.getLogger(RegisterStudent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new RegisterStudent().setVisible(true);

});

public void connect()

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");

public void disconnect()

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;

public class IssueBook extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

String query;

Date date=new Date();

SimpleDateFormat format=new SimpleDateFormat("dd-MM-yyyy");

String checkAvailability,SName,Address,SStream,SClass;

public IssueBook() {

initComponents();

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

if(t2.getText().equals(""))

JOptionPane.showMessageDialog(this,"मान ना मान मैं तेरा मेहमान\nama yaar pehle registration to karwao");

else

try

connect();

query="select * from books where BookId='"+t3.getText()+"';";

rs=stmt.executeQuery(query);

rs.next();

if(t6.getText().equals("YES"))

query="insert into issue values('"+t1.getText()+"','"+t2.getText()+"','"+t3.getText()+"','"+t4.getText()


+"','"+Address+"','"+t5.getText()+"','"+SStream+"','"+SClass+"');";

stmt.executeUpdate(query);

19
JOptionPane.showMessageDialog(this,"Book with id = "+t3.getText()+" has been issued to "+t2.getText());

query="update books set Available='NO' where BookId='"+t3.getText()+"';";

stmt.executeUpdate(query);

if(t6.getText().equals("NO"))

JOptionPane.showMessageDialog(this,"Book with this id is not available currently");

if(t6.getText().equals(""))

JOptionPane.showMessageDialog(this,"There is no book in the library with this id");

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 ");

public static void main(String args[]) {

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(ReturnBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

20
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(ReturnBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(ReturnBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(ReturnBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new IssueBook().setVisible(true);

});

public void connect()

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");

public void disconnect()

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;

public class IssuedBooks extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

String query;

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

try

connect();

query="select * from issue where stream='"+c1.getSelectedItem()+"' and class='"+c2.getSelectedItem()+"';";

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)

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

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;

public class AddNewBook extends javax.swing.JFrame {

Connection con;

Statement stmt;

String query;

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

if(txt2.getText().equals(""))

JOptionPane.showMessageDialog(this,"Please enter Book id");

else if(txt3.getText().equals(""))

JOptionPane.showMessageDialog(this,"Please enter Book name");

else if(txt3.getText().equals(""))

JOptionPane.showMessageDialog(this,"Please enter author name");

else if(c3.getSelectedItem().equals("Select Stream"))

JOptionPane.showMessageDialog(this,"Please select stream");

else if(c4.getSelectedItem().equals("Select Class"))

JOptionPane.showMessageDialog(this,"Please select class");

else

try

connect();

query="insert into books values('"+txt2.getText()+"','"+txt3.getText()+"','"+txt4.getText()+"','"+c3.getSelectedItem()


+"','"+c4.getSelectedItem()+"','YES');";

stmt.executeUpdate(query);

disconnect();

JOptionPane.showMessageDialog(this,"New book added to Library");

txt2.setText("");

txt3.setText("");

23
txt4.setText("");

c3.setSelectedIndex(0);

c4.removeAllItems();

c4.addItem("Select Class");

catch(SQLException e)

if(e.getErrorCode()==1062)

JOptionPane.showMessageDialog(this,"BookId is a primary key\nduplicate entry is not allowed\nit should be unique");

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;

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

try

connect();

query="select * from books where stream='"+c1.getSelectedItem()+"' and class='"+c2.getSelectedItem()+"';";

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);

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

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");

private void txt1KeyReleased(java.awt.event.KeyEvent evt) {

DefaultTableModel model=(DefaultTableModel)table.getModel();

model.setRowCount(0);

String txt=txt1.getText();

if(txt.equals(""))

System.out.println("");

else

try

25
{

connect();

query="select * from books where BookName LIKE \"%"+txt1.getText()+"%\";";

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");

Object[] row = {BId,Bname,Bauthor,strm,cls,avl};

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;

Date date=new Date();

SimpleDateFormat format=new SimpleDateFormat("dd-MM-yyyy");

private void t1KeyReleased(java.awt.event.KeyEvent evt) {

try

connect();

query="select * from issue where StudentId='"+t1.getText()+"';";

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));

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

try

connect();

query="select * from issue where StudentId='"+t1.getText()+"';";

rs=stmt.executeQuery(query);

if(rs.next())

query="insert into returndetail values('"+t1.getText()+"','";

query+=t2.getText()+"','"+t3.getText()+"','"+t4.getText()+"','"+t5.getText()+"','"+t6.getText()+"');";

stmt.executeUpdate(query);

query="delete from issue where StudentId='"+t1.getText()+"';";

stmt.executeUpdate(query);

query="update books set Available='YES' where BookId='"+t3.getText()+"';";

stmt.executeUpdate(query);

disconnect();

27
JOptionPane.showMessageDialog(this,"Thank you! visit again");

t4.setText("");

t1.setText("");

t2.setText("");

t3.setText("");

t5.setText("");

else

JOptionPane.showMessageDialog(this,"No book is issued on this id currently");

catch(SQLException e)

JOptionPane.showMessageDialog(this,e);

} }

private javax.swing.JButton jButton2;

private javax.swing.JButton jButton3;

private javax.swing.JButton jButton4;

private javax.swing.JButton jButton5;

private javax.swing.JButton jButton6;

private javax.swing.JButton jButton7;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

// End of variables declaration

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

You might also like