Professional Documents
Culture Documents
OF
LIBRARY MANAGEMENT
SYSTEM
[PROJECT REPORT]
COMPILED BY-
NIRUPAMA
GUIDED BY-
Mrs. Shabana Parveen
This is to certify that NIRUPAMA Of STD XII ‘D’ COMMERCE has
completed her project under my guidance and supervision I certify that
this project is in with accordance with the guidelines issued by CBSE.
Date ………..
(Signature)
Teacher in charge
I am thankful to Mrs. Shabana Parveen my Informatics
Practices teacher who has provided requisite
guidance and help for the successful completion of
this project and also last but not the least I would like
to thank all those who directly or indirectly helped
me in the successful completion of
this project
Date…...............
(Signature)
Student
CONTENTS
A. System Description at a glance
B. Problem Description
C. Database Design
D. Project Control Flow
E. Project Output
The can get the books and journals for reading /reference.
They can get books issued, so that they can take them home and return them on or before
due date.
For providing the reading services, library purchases books from the market. When arrived in the
library, they are physically inspected and if they are found in order, they are taken into account,
else they are rejected. Details of the books are noted in the acquisition register. After these
formalities, books can be issued to the readers on their request.
When a member request for a book, librarian searches it in the library according to the
acquisition number and the accession number of the book. If it is available (not issued to other
member) then it is issued to the member and details of the issue are noted down in a register called
issue register.
After reading the book, member returns the book to the librarian. At the time of returning of the
book, librarian should update the library and member data.
Time to time librarian scans through the issue register and finds out list of books, which are issued
and should return in time.
Followings are the activities of librarian of BRITISH library:
Acquisition of book
Membership maintenance
Book issue
Book return
Answer management queries
Problem Description
Acquisition of Books
Purchase department of the library purchases various books. After purchase, these books are inspected and
if found in order a unique number called acquisition number is assigned to each book. Purchase
department then sends these books to librarian. Based on the subject, author of the books etc., librarian
assigns a code to the book. This code is called as accession number. He also enters various details regarding
a book in acquisition register. He changes entries of the acquisition register, if some change in book
information takes place. Format of acquisition register is given below:
Acquisition Register
Membership Maintenance
A person, who wants to be a member of the library, has to fill an application form and given it to the
librarian along with membership fee (minimum 2000) and caution money (500)
Librarian assigns a unique membership number to him and enters the details of this member in
membership register. After some time, if any member wants to reduce or increase his caution money,
librarian makes changes accordingly in the membership modification form. If a member wants to
discontinue in between, librarian strikes off his entry form the membership register and returns the caution
money. Format of membership register is given below:
MEMBERSHIP REGISTER
Librarian issue only one book at a time to a member. A member fills a requisition slip and
requests the librarian to issue the book to him. Format of the requisition slip is checked by the
librarian and the librarian first checks in member register, whether his membership is still
continuing. If not, he does not accept the request else he physically checks for the presence of the
book in the library. If not present, he rejects the request of the member; otherwise he issues the
book to member. Librarian notes down the details in Issue register. Format of issue register is
given below:
ISSUE REGISTER
When a member return a book the librarian should update the library register (set Status as
‘y,’i.e., available) and member register (set mem- issue as ‘N’, i.e, not issued) properly.
Database Design
The following are the six table with respective fields:
1) Table : Publisher
MySQL Command
2) Table : LIB
3) Table : MEMBER
MySQL Command
MySQL Command
MySQL Command
Source Code :
pubULjava
Used Class/Packages
import java.sql.*;
import javax.swing.]OptionPane;
if(Pno.length( ) <4)
{
int x Pno.length( );
int nl = 4-x;
while( nl>O){
Pno = Pno + “”;
nl- -
}
dModel.addElement(Pno +”-“ + PName);
}
jListl .setModel(dModel);
con.close( );
} catch (Exception e) {
JOptionPane.showMessageDialog(this,e.getMessage( ));
e printStacklrace( );
}
Mouse click event Procedure:
private void jListlMouseClicked(java .awt. event. MouseEvent evt) {
// getSelectedValue() method extracts the current cursor location value into a variable
String MPub = (String) jListl.getSelectedValue( );
// Extract the first 4 characters as publisher ID into a variable
String PubN =MPub.trim( ).substring(O, 3);
String query = ‘SELECT * FROM Publisher WHERE pub_id = “+ PubN +”;”;
try{
Class.forName(“com.mysql.jdbc.Driver”).newInstance( );
Connection con = (Connection)
DriverManagergetConnection( “jdbc:mysql://localhost:3306/Library”,”root”,”reeta”);
// Create SQL statement and execute query.
Statement stmt = con.createStatement( );
ResultSet rs = stmt.executeQuery(query) ;
if (rs.nextO) {
//PubN = rs.getString(”pub_no”);
String PubName = rs.getString(“pub_name”);
String PubAdd = rs.getString( “pub_address”);
String PubPhl = rs.getString( “pub_phone1”);
String PubPh2 = rs.getString(“pub_phone2”);
String PStatus = rs.getString(”status”);
// Displaying the contents in respective text boxes.
txtPno.setText(PubN);
txtPName.setText(PubName);
txtPAdd.setText(PubAdd);
txtPhlsetText(PubPhl);
txtPh2.setText(PubPh2);
txtStatus.setText(PStatus):
txtPrio.setEditable(false);
// Close the operational object for Student
con .close( );
stmt.close( );
rs.cloe( );
}else{
JOptionPane.showMessageDialog(null , “Record does not found in publisher
table”);
}
} catch (Exception e) {
JOptionPaneshowMessageDialog(this, e.getMessage( ));
}
}
Class.IorName(’com.mysql.jdbc. Driver”);
Connection con (Connection)
DriverManager.getConnection(“jdbc: mysql://localhost/3306/Library”,”root” ,
“reeta”);
stmt = con.createStatement( );
rs = stmt.executeQuery(SQL);
while (rs.next()) {
String Pno = rs.getString(“pub_id”);
String PName = rs.gctString(“pub_name”);
// To make the publisher no. as 4 digit because we will extract 4 digit
fromlist value
//in mouse click event.
if (Pno.length() < 4)
{
int x = Pno.length();
intt ni = 4 - x;
while (nl > 0){
Pno = Pno +” ”;
nl--;
}
}
dModel.addElement(Pno + + PName);
}
jList1.setModel(dModel);
con.close();
} catch (Exception e) {
J0ptionPane.showMessageDialog(this,e.getMessage( ) );
e. printStackTrace( )
}
}
Publisher Navigation (PubNavUI.java)
}
}catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage( ));
used Class/Packages
import java.sql.*;
import javax.swing.]OptionPane;
irnport javax,swing.DefaultListModel;
GIobaL Variables:
GlobaI Variables
JOptionPane,showMessageDialog(this,’Record modified);
catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage( ));
}
}
Form load procedure
private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {
txtAcno .setEditable(false);
txtPID .setEditabie(false);
txtStatus. setEdita bie(false);
// Creating a ListModel object dModel to perform DefaultListModel
// method operations
DefaultListModel dModel = (DefaultListMod jListl .getModel();
// Method to add elements into jListl control
dModeLclear( );
try {
Class. forN ame( corn mysqi.jdbc. Driver’)
Connection con = (Connection)
DriverManager.getConnection(“jdbc:mysql://localhost:3306/Library
“,”root”,reeta);
stmt = con.createStatement();
rs =strntexecuteQuery(SQL);
while (rs,next()) {
String Ano = rs.getString(“acc_no”);
String BTitle = rs.getStr:ng(“BTitle”);
// To make the Accession no. as 4 digit because we will extract 4 digit from list value
//in mouse click event.
if (Ano.length() < 4)
}
int x = Ano.Iength();
int nl = 4 - x;
while (ni > O){
Ano=Ano± “;
DModeLaddElement(Ano + “- + BTitle);
}
jListl .setModel(dModel);
// To list the publisher id and name into JComboBoxl.
DefaultComboBoxModel cModel = (DefaultComboBoxModel) jComboBoxl.getModelQ;
cModeLremoveAl(Elements();
stmtl = con.createStatement(); // To list publishers in iComboBoxi component
rsl = stmtl.executeQuery(SQL1);
while (rsl.next()) {
String pubno = rsl.getString(“pub_id”);
String pubName = rsl.getString(“pub_ name’);
// To make the publisher no. as 4 digit because we will extract 4 digit from list value
// in mouse click event
txtstatus.setText(”Y”); // Because it is a new book, when it will be issue,
// its status will be N.
if (pubno.length() < 4)
{
int x = pubno,length();
int nl = 4 - x;
while (nl >0){
pbno = pbno+””;
nl--;
}
}
cModel.addElement(Pbno+”-“+Pubname);
}
}catch (Exception e){
JOptionPane.ShowMessageDialog(this,e.getMessage());
e.printStackTrace();
}
}
Exit ActionEvent Procedure
private void cmdExitActionPerformed(java .awt. event.ActionEvent evt) {
this.setVisible(false);
}
Mouse click event Procedure
private void jListlMouseClicked(java.awt.event.MouseEvent evt) {
// getSelectedValue() method extracts the current cursor location value
String MBook = (String) jListl.getSelectedValue(),
// Extract the first 4 characters as Accession number into a variable
String Acno =MBook.trim().substring(O, 3);
String query = “SELECT * FROM Lib WHERE accno = + Acno + “;”;
try {
Class .forNa me( corn mysql.jdbc. Driver’) newlnstance();
Connection con = (Connection)
DriverManager.getConnection(”jdbc://localhost: 3306/Library”,”root”,”reeta”);
// Create SQL statement and execute query.
stmt = con.createStatement();
rs stmt.executeQuery(query);
if (rs,nextQ) {
String bTitle = rs.getString(”btitle”)
String Authl = rs.getString(”author”)
String Auth2 = rs.getString(’author2);
String PID = rs.getString(’pubjd’);
String Price = rs.getString(’price”);
String PDate = rs.getString(”pdate);
String pages = rs.getString(”pages”)
String edition = rs.getString(’edition”)
String PStatus = rs. getString(’status’);
// Displaying the contents in respective text boxes.
txtAcno.setText(Acno);
txtBT itle.setText(bTitle);
txtAuth 1 .setText(Auth 1);
txtAuth2.setText(Auth2);
txtPID.setText(PID);
txtPrice. setText( Price);
txtPD txtPages. setText( pages);
txtEd ition .setText(edition);
txtStatus.setText( Status);
// Close the operaional object for Student
con.close();
stmt.close();
rsclose();
} else {
JOptionPane.showMessageDialog(null, “Record does not found in Student table’);
}
} catch (Exception e) {
JOptionPane.showMessageDiaIog(th e.getMessage());
}
}
Book Deletion( LibDelUl.java)
if (Mno.length() < 4)
{
nt x = Mno.Iength();
nt ni = 4 - x;
while (ni >0){
Mno = Mno +””;
ni--;
}
}
dModel.addEiement(Mno -i- “- + MName);
jListl .setM odel( dModel);
// cModei to perform DefaultListModel for Library //
I method operations
DefaultListModel cModel (DefauitListModel) jList2getModelQ;
// Metnod to add elements into jLisd control for Library cModel.clearO,
// Listing books
stmtl = con.createStatement();
rsl = stmtl .executeQuery(SQL1);
while (rslnext()) {
String Ano = rsl.getString( acc_no’);
String BTitle = rsl.getString(”btitie’);
// To make the Accession no. as 4 digit because we will extract 4 digit from list value
// in mouse click event.
if (Anolength() < 4)
{
int x = Ano.Iength();
int ni 4 - x;
while (nl >0){
Ano = Ano +””;
nl--;
}
}
cModel.addElement(Ano + ‘- “ -i- BTitle);
}
jList2setMode (cModel);
} catch (Exception e) {
JOptionpane.showMessageDialog(this,e,getMessage());
e.printStackTrace();
}
}
EXITActionEvent Procedure;
private void cmdExitActionPerformed(java.awt.event.Action eventdf evt){
this.setVisible(false);
}
Mouse click event Procedure
private void jList2MouseClicked(java.awt.event.MousEvent evt){
// getSelectedValue() method extracts the current cursor location value into a variable
String MBook = (String) jList2.getSelectedValue();
// Extract the first 4 characters as Accession number into avariable
String Acno =MBook.trim().substring(0, 3);
String query = SELECT * FROM Lib WHERE acc_no = “ + Acno+”;
try {
Class.forName(”com . mysql.jdbc. Driver”). newlnstance();
Connection con = (Connection) DriverManager.getConnecton(jdbc:mysql://
localhost:3306/Library”,”root”,”reeta”);
/ / Create SQL statement and execute query
. stmt1 = con.createStatement();
rs = stmt 1.executeQuery(query);
if (rsl.next()) {
String bTitle = rs1.getString(“btitle”);
String Auth1 = rs1.getString(“auth1”);
String PID=rsl.getString(“pub_id);
String PStatus = rsl .getString(”status”);
// Displaying the contents in respective text boxes
. txtAcno .setText(Acno);
txtBTitle. setText( bTitle);
txtAuth 1 .setText(Auth 1);
txtPID.setText(PID);
txtStatus.setText(PStatus);
} else {
JOptionPane.showMessageDialog(null, “Record does not found in Libdent table’);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
Issue Action Event Procedure
private void cmdlssueActionPerformed(javaawt.event.ActionEvent evt) {
try {
Class.forName(”com.mysql.jdbc. Driver’);
Connection con = (Connection)
DriverManager.getConnection(“jdbc: mysql://localhost: 3306/Library”,”root’,”reeta”);
// Missue table
stmt2 = concreateStatement();
rs2 = stmt.executeQuery(SQL);
// Tissue table
stmt3 = con.createStatement();
rs3 = stmt.executeQuery(SQL);
int Acno = Integer,parseInt(txtAcno.getText().trim());
i nt Mno = Integer.parseInt(txt Mno.getText().trim());
String idt = tx1Date.getText();
String rdt = idt; // Temporarily assigned for testing purpose
int code = JOptionPane.showConfirmDialog(this,” Are you sure to add?”,
“Confirmation Dialog Box”, JOptionPaneYES_NOCANCELOPTION,
JOptionPane. INFORMATION MESSAGE);
if (code == JOptionPane.YES OPTION) {
// Record updated into Missue and Tissue tables
String strSQL = “INSERT INTO Missue(acc_no, memb_no, date, rdate)
VALUES (“+(Acno)+”, “+(Mno)+”, “+(idt)+”’, ‘“+(rdt)+”)”;
String strSQLl = “INSERT INTO Tissue(acc no, memb_no, date, rdate)
VALUES (“+(Acno)+”, “+(Mno)+”, “- ‘“+(rdt)+”’)”;
stmt2 executeUpdate(strSQL);
stmt3.executeUpdate(strSQLl);
// Listing Members
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
while (rs,next()) {
String Mno = rs,getString(memb no);
String MName = rs.getString(memb_narne);
// To make the Member no. as 4 digit because we will extract 4 digit from list val.
//in mouse click event.
Global Variables :
Statement stmt = null;
ResuitSet rs null; // ResuitSet for publisher table.
String SQL = ‘SELECT * FROM Member;
ActionEvent Procedures
private void cmdClearActionPerformed(java awt.event.ActionEvent evt) {
txtMNo.setText(”);
txtMName.setText(””);
txtMAdd.setText(“”);
txtMPh.setText(’”);
txtMDate.setText(“”);
txtMFee.setText(“”);
txtMStatus.setText(“”);
cmdSave.setEnabled(false);
}
Edit ActionEvent Procedure
private void cmdEditActionPerformed(java.awt.event,Act evt) {
this.setV ible(false);
new MembEditUI().setVisible(true);
}
Exit ActionEvent Procedure
private void cmdExitActic Performed(java.awt.evootActionEvent evt) {
this.setVsible(false);
}
save ActionEvent Procedure
MNO = rs.getlnt(“memb_no”);
MNO++;
Mno = MNO;
txtMNo.setText(lnteger.toString(Mno));
txtMName.setFocusable(true);
} catch (Exception e)
JOptionPane show Message Dialog (this, e.getM essage( ));
e.printStackTrace();
}
}
Used Class/Packages
import java.sql*;
import javax.swing.JOptionPane
import javax.swing.DefaultListModel;
Global Variables
rs = Stmt.executeQuery(query)
}
if(rs.next()){
String MName = rs.getstring(”memb_name”)
String mAdd = rs.getstring(“memb_ add”);
String MPh1 = rs.getstring(“memb_ phone”);
String MDate = rs.getstring(“mdate”);
String MEDate = rs.getstring(”medate”)
String MFee = rs.getString(”mfee”),
String NiStatus = rs.getString(“ status’);
String Missue rs.getString(’mem_issue”);
// Displaying the contents in respective text boxes.
txtM No. setText(Mno);
txtMName. setText(MName);
txtMAdd .setlext(MAdd);
txtNl Ph .setText(MPhl);
txtMDate.setText(Mdate);
txtM Pee.setText(M Fee);
txtM Status.setText(Mstatus);
txtM Status .setEditable(false);
} else {
JOptionPane.showMessageDialog(null, “Record does not found in Member table”);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
rs = stmt.executeQuery(SQL);
while (rs.next()){
Strirg Mno = rs.getString(”rnemb_no”);
Stnrg MName rs.getString(’rnemb _name’);
// To make the Member no. as 4 digit because we will extract 4 digit from list value
//in mouse click event.
if (Mno.length() <4)
{
int x = Mno.length();
int nl = 4 – x ;
while (nl > 0) {
Mrio = Mi o + “”;
nl- -;
}
}
Used Class/Packages
import java.sql*;
mport javax.swing.JOptionPane;
import javax.swing.DefaultListModel;
Global Variables
ActionEvent Procedures :
try {
Class.forName(”com.mysql.jdbc.Driver’);
Connection con = (Connection)
DriverManager.getConnection(’jdbc: mysql:// locaihost:
3306/Library”,”root’,”reeta”);
// Create SQL statement and execute query.
stmt = con.createstatement();
r stmt.executeQuery(query);
if (rs.nextQ) {
String MName = rs.getString(”memb_name”)
String mAdd = rs.getstring(“memb_ add”);
String MPh1 = rs.getstring(“memb_ phone”);
String MDate = rs.getstring(“mdate”);
String MEDate = rs.getstring(”medate”)
String MFee = rs.getString(”mfee”),
String NiStatus = rs.getString(“ status’);
String Missue rs.getString(’mem_issue”);
// Displaying the contents in respective text boxes.
txtMNo.setText(Mno);
txtMName.setText(MName);
txtMAdd . setText(MAdd);
txtMPh.setText(MPh 1);
txtMDate.setText(MDate);
txtM Fee .setText( MFee);
txtMStatus,setText( Mstatus);
txtMStatus.setEditable(false);
} else {
JOptionPane.showMessageDialog(null, “Record does not found in Member
table”);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage();
}
}
Used Class/Packages
import java.sql.*;
import javax.swing.JOptionPane;
} else {
JOptionPane.showMessageDialog(this, You are already at last record”, “Student”,O);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
cmdFirst.setEnabled(true);
cmdNext.setEnabled(true);
cmdPrev.setEnabled( true);
cmdLast.setEnabled(true);
} else {
cmdNext.setEnabled(false);
JOptionPane.showMessageDialog(this,” You are at last record position”,
“Student”,0);
}
}catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
cmdFirst.setEnabled(false);
cmdNext.setEnabled(true);
cmdPrev.setEnabled( false);
cmdLast.setEnabled(true);
} else {
cmd First. setEna bled (false)
cmd Next. setE na bled (false)
crnd prev.setEflabled(false)
cmd Last.setEna bled (false)
JOptionPane.showMeSSageDialOg(this, Rhere is no record in table’, “Student’,O);
}
} catch (Exception e) {
JOptionpane.showMessageDialog(this,e.getMessageO);
}
}
cmdFirst.setEnabled(false);
cmdNext.setEnabled(true);
cmdPrev.setEnabled( false);
cmdLast.setEnabled(true);
} else {
cmd First. setEna bled (false)
cmd Next. setE na bled (false)
crnd prev.setEflabled(false)
cmd Last.setEna bled (false)
JOptionPane.showMeSSageDialOg(this, Rhere is no record in table’, “Student’,O);
}
} catch (Exception e) {
JOPtionPane.showMessageDialog(this, e.getMessage());
}
}
Available Book List (ABListUl.java)
Used Class/Packages
import javax.swing.table.*;
import java.sqi.*;
import javax.swing.JOptionPane;
Used Class/Packages
import javax.swing.table.*;
import java.sql.*;
import javax.swing.JOptionPane;
NIRUPAMA
Class-Xii
Roll No _______
Students Data
Name : NIRUPAMA
Class : XII
Div : “D”
Roll No :
School : Kairali School
Sector-II,
Dhurwa,Ranchi
Jharkhand