• No results found

Library Management System

N/A
N/A
Protected

Academic year: 2021

Share "Library Management System"

Copied!
73
0
0

Loading.... (view fulltext now)

Full text

(1)

 

P

R

 

Unde

P

ROJECT

R

EPORT

 

er guida

L

 

ance o

Library

of Prof.

y Mana

Vinaya

agemen

k Pand

nt Syst

a | Me

tem

 

egha Kuumari

(2)

Library Management System  Department of Information Technology, GIET, Gunupur 

A

Project Report

On

“Library Management System” 

Submitted in partial fulfillment of

The requirements for the award of the 7

th

Semester of

BACHELOR OF TECHNOLOGY

IN

Information Technology

 

By 

       MEGHA KUMARI (1001210535) 

       

 

Under the esteemed guidance of 

Prof. Vinayak Panda 

        DEPARTMMENT OF INFORMATION TECHNOLOGY 

GANDHI INSTITUTE OF ENGINEERING AND TECHNOLOGY 

GUNUPUR – 765022 

2013‐14 

 

 

(3)
(4)

Dep  

       

 

     

T

Sys

of

Inf

sub

(Pro Pr artment of I

      

This is

stem” is

the requ

formation

bmitted t

of. Vianayak oject Super nformation T

  

 

D

to certif

done by

uirements

n Techn

o the dep

k Panda ) rvisor Technology, 

epartm

fy that

y

MEGHA

s for the

nology d

partment

Library M GIET, Gunup

ment of I

CER

the proj

A KUMA

award o

during th

as a part

Managemen pur 

nforma

RTIFIC

ject wor

ARI, Regd

of the de

he acade

t of evalu

nt System 

ation Te

CATE

rk entitle

d. No .100

egree of

emic ye

uation of

(Prof

chnolog

ed “Lib

01210535

f Bachelo

ar 2013

f 7

th

Sem

f.(Dr.)PRAG H.

gy 

rary M

in partial

or of Tec

3-14. Th

ester Pro

GNYABAN M .O.D, IT

Managem

l fulfillm

chnology

his work

oject.

MISHRA)

ment

ment

y in

k is

(5)

ACKNOWLEDGEMENT

The completion of this project consists of precious guidance and direction of many people and hence in order to pay my respect, I would like to acknowledge all of them.

My primary obligation goes to the Gandhi Institute for giving me the golden opportunity to work in an environment extremely conducive for learning and helping to gain an insight into the actual working of an organisation.

I am grateful to Prof. “ Vinayak Panda ” for making our work interesting and exciting by giving valuable guidance, encouragement, motivation and concrete support. Despite having a busy schedule he was always ready to spare time and give innovative technical assistance throughout the development on the project. Last but not the least I would like to thank my family and friends whose silent support helped me through the making of the project.

(6)

Library Management System 

Department of Information Technology, GIET, Gunupur 

ABSTRACT

In this project we have attempted to create an environment where people can keep in contact with each other on the internet easily. People living at various places in the world can spend some quality time together exchanging messages.

Our vision is to bring people close even after being located at furthest points on earth. They can sit together and enjoy exchanging ideas and their views, comments and revive the old times together, or make new friends and have fun with them.

The world is getting faster day by day, people do not have time to travel to the places where their loved ones live. Instead, they use communication mediums like telephone, VOIP, emails, letters and so on to keep in touch. Technology has grown up to the extent that communication constraint of one-to-one has been replaced by many-to-many.

Creating a social networking site helps people interact with their friends and also learn new things from people. They can meet new people and acquire information. In short, they open their eyes and ears to the world around them.

(7)

TABLE OF CONTENTS

Chapter No. TITLE

PAGE No.

1. Introduction

2. System Analysis

2.1

Existing System 2.2 Proposed System 2.3 Feasibility Analysis

3.

Configuration

3.1 Hardware Configuration 3.2 Software Configuration

4.

System Design and Specification

4.1 High Level Design

4.1.1 Data Flow Diagram 4.1.2 ER Diagram

4.2 Low Level Design

4.2.1 Software Interface 4.3 System Design 4.3.1 Input Design 4.3.2 Output Design 4.3.3 Database Design

5.

System Implementation

6.

Coding

6.1 Sample Coding

7.

System Testing

5.1 Unit Testing 5.2 Integration Testing 8.

Conclusion

 

(8)

Library Management System 

Department of Information Technology, GIET, Gunupur 

INTRODUCTION 

The project titled Library Management System is Library management software for monitoring and controlling the transactions in a library .The project “Library Management

System” is developed in java, which mainly focuses on basic operations in a library like

adding new member, new books, and updating new information, searching books and members and facility to borrow and return books.

“Library Management System” is a windows application written for Windows operating systems, designed to help users maintain and organize library. Our software is easy to use for both beginners and advanced users. It features a familiar and well thought-out, an attractive user interface, combined with strong searching Insertion and reporting capabilities. The report generation facility of library system helps to get a good idea of which are the books borrowed by the members, makes users possible to generate reports’ hard copy.

The software Library Management System has four main modules.  Insertion to Database Module – User friendly input screen  Extracting from Database module – Attractive Output Screen

 Report Generation module – borrowed book list & Available book list  Search Facility system – search for books and members

(9)

SYSTEM ANALYSIS

         EXISTING SYSTEM:

System Analysis is a detailed study of the various operations performed by a system and their relationships within and outside of the system. Here the key question is- what all problems exist in the present system? What must be done to solve the problem? Analysis begins when a user or manager begins a study of the program using existing system.

During analysis, data collected on the various files, decision points and transactions handled by the present system. The commonly used tools in the system are Data Flow Diagram, interviews, etc. Training, experience and common sense are required for collection of relevant information needed to develop the system. The success of the system depends largely on how clearly the problem is defined, thoroughly investigated and properly carried out through the choice of solution. A good analysis model should provide not only the mechanisms of problem understanding but also the frame work of the solution. Thus it should be studied thoroughly by collecting data about the system. Then the proposed system should be analyzed thoroughly in accordance with the needs.

System analysis can be categorized into four parts.  System planning and initial investigation  Information Gathering

 Applying analysis tools for structured analysis  Feasibility study

 Cost/ Benefit analysis.      

In our existing system all the transaction of books are done manually, So taking more time for a transaction like borrowing a book or returning a book and also for searching of members and books. Another major disadvantage is that to preparing the list of books borrowed and the available books in the library will take more time, currently it is doing as a one day process for verifying all records. So after conducting the feasibility study we decided to make the manual Library management system to be computerized.

 

 

 

(10)

Library Management System 

Department of Information Technology, GIET, Gunupur 

PROPOSED SYSTEM

  Proposed system is an automated Library Management System. Through our software user can add members, add books, search members, search books, update information, edit information, borrow and return books in quick time. Our proposed system has the following advantages.

 User friendly interface  Fast access to database  Less error

 More Storage Capacity  Search facility

 Look and Feel Environment  Quick transaction

All the manual difficulties in managing the Library have been rectified by implementing computerization.

(11)

FEASIBILITY ANALYSIS

Whatever we think need not be feasible .It is wise to think about the feasibility of any problem we undertake. Feasibility is the study of impact, which happens in the organization by the development of a system. The impact can be either positive or negative. When the positives nominate the negatives, then the system is considered feasible. Here the feasibility study can be performed in two ways such as technical feasibility and Economical Feasibility.

Technical Feasibility:

We can strongly says that it is technically feasible, since there will not be much difficulty in getting required resources for the development and maintaining the system as well. All the resources needed for the development of the software as well as the maintenance of the same is available in the organization here we are utilizing the resources which are available already.

Economical Feasibility:

Development of this application is highly economically feasible .The organization needed not spend much m one for the development of t he system already available. The only thing is to be done is making an environment for the development with an effective supervision. I f we are doing so , we can attain the maximum usability of the corresponding resources .Even after the development , the organization will not be in a condition to invest more in t he organization .There fore , the system is economically feasible.

 

 

 

 

(12)

Library Management System 

Department of Information Technology, GIET, Gunupur 

HARDWARE CONFIGURATION

Processor : Pentium III 630MHz

RAM : 512 MB Hard Disk : 30 GB

Monitor : 14” Color monitor Key Board : 122 Keys

 

 

 

 

 

(13)

SOFTWARE CONFIGURATION

Operating System : Windows 98, Windows XP, Windows Vista, Windows 7.

Language : Java 2 Runtime Environment Database : MS Access 2007

(14)

Dep

DA

 

 

 

artment of I

ATA FLOW

nformation T

W DIAG

Technology, 

System

RAM

Library M GIET, Gunup

m Desig

Managemen pur 

gn and

nt System 

Specificcation

(15)

 

 

 

 

 

 

(16)

Library Management System  Department of Information Technology, GIET, Gunupur 

E R DIAGRAM

Book

Book name

Return date

Reserved Flag

Book issue to

Book id

Status

Book return

Book Author

Book Category

Reserve By

Issue date

Usernpasswd

Password

User Id

(17)

userdata

User name

NumberOfBooksTaken

User Id

Gender

Department

Course

Semester

adminlog

Password

User Id

(18)

Library Management System  Department of Information Technology, GIET, Gunupur  userdata User name NumberOfBooksTaken User Id Gender Department Course Semester Librarian Password User Id Books Return date Book Id Issue date Book Author Reserved Flag Book issue to Status usernpass Password Book Category Book return Reserve By Issue Borrow by User Id Access to

(19)

S

SOFT

TWAR

We

L

RE IN

elcome P

Login Pag

NTERF

Page

ge

FACE

E

(20)

Department of Information TTechnology,  Library M GIET, Gunup

Admi

Staf

Managemen pur 

in Login

ff Login P

nt System 

n Page

Page

(21)

Membe

All Bo

er’s Tab

ook Deta

ble Page

il Page

(22)

Department of Information TTechnology, 

A

Library M GIET, Gunup

Sea

Adminst

Managemen pur 

arch Boo

rator Lo

nt System 

oks

ogin Pag

ge

(23)

Ad

A

d New U

Add Boo

User

ok

(24)

Dep

 

artment of Information TTechnology,  Library M GIET, Gunup

Staf

Managemen pur 

ff Login P

 

nt System 

Page

(25)

SYSTEM DESIGN

INPUT DESIGN

Input design is the process of converting user-oriented input to a computer based format. Input design is a part of overall system design, which requires very careful attention .Often the collection of input data is the most expensive part of the system. The main objectives of the input design are …

1. Produce cost effective method of input 2. Achieve highest possible level of accuracy

3. Ensure that the input is acceptable to and understood by the staff.

OUTPUT DESIGN

Outputs from computer systems are required primarily to communicate the results of processing to users. They are also used to provide a permanent copy of these result for latter consultation .Computer output is the most important and direct source of information to the users. Designing computer output should proceed in an organized well throughout the manner. The right output must be available for the people who find the system easy o use. The outputs have been defined during the logical design stage. If not, they should defined at the beginning of the output designing terms of types of output connect, format, response etc,

All screens are informative and interactive in such a way that the user can full fill his requirements through asking queries.

(26)

Library Management System 

Department of Information Technology, GIET, Gunupur 

DATABASE DESIGN

The general theme behind a database is to handle information as an integrated whole. A database is a collection of interrelated data stored with minimum redundancy to serve many users quickly and effectively. After designing input and output, the analyst must concentrate on database design or how data should be organized around user requirements. The general objective is to make information access, easy quick, inexpensive and flexible for other users. During database design the following objectives are concerned:-

 Controlled Redundancy  Data independence  Accurate and integrating  More information at low cost  Recovery from failure

 Privacy and security  Performance

 Ease of learning and use

 

 

 

 

 

(27)

TABLES USED

TABLE NAME: adminlog

Field Name  Data Type  Description 

User id   Text  Primary Key 

Password  Text  ‐ 

TABLE NAME: books

Field Name  Data Type  Description 

Book Id  Text  Primary Key 

Book name  Text  ‐  Book Author  Text ‐ Book Category  Text  ‐  Book issue to  Text  ‐  Status  Number  ‐  Book return  Number  ‐  Reserved Flag  Number  ‐  Reserve By  Text ‐ Issue date  Date  ‐  Return date  Date  ‐ 

(28)

Library Management System 

Department of Information Technology, GIET, Gunupur 

TABLE NAME: usernpasswd

Field Name  Data Type  Description 

User Id  Text  Primary Key 

Password  Text  ‐ 

 

 

TABLE NAME: userdata

Field Name Data Type Description

User Id Text Primary Key

User name Text -

Gender Text - Department Text - Course Text - Semester Text - NumberOfBooksTaken Text -

 

 

 

 

 

 

 

(29)

SYSTEM IMPLEMENTATION

Implementation is the stage in the project where the theoretical design is turned into a working system. The implementation phase constructs, installs and operates the new system. The most crucial stage in achieving a new successful system is that it will work efficiently and effectively.

There are several activities involved while implementing a new project they are  End user training

 End user Education

 Training on the application software  System Design

 Parallel Run And To New System  Post implementation Review

END USER TRAINING:

The successful implementation of the new system will purely upon the involvement of the officers working in that department. The officers will be imparted the necessary training on the new technology.

END USER EDUCATION:

The education of the end user start after the implementation and testing is over. When the system is found to be more difficult to understand and complex, more effort is put to educate the end used to make them aware of the system, giving them lectures about the new system and providing them necessary documents and materials about how the system can do this.

TRAINING OF APPLICATION SOFTWARE:

After providing the necessary basic training on the computer awareness, the users will have to be trained upon the new system such as the screen flows and screen design type of help on the screen, type of errors while entering the data , the corresponding validation check at each entry and the way to correct the data entered. It should then cover information needed by the specific user or group to use the system.

(30)

Library Management System 

Department of Information Technology, GIET, Gunupur 

POST IMPLEMENTATION VIEW:

The department is planning a method to know the states of the past implementation process. For that regular meeting will be arranged by the concerned officers about the implementation problem and success

 

 

 

 

(31)

CODING

ADMIN LOGIN PAGE SAMPLE CODE

/*NewAccount.java */ 

import java.awt.*; 

import java.awt.event.*; 

import javax.swing.*; 

import java.sql.*; 

import javax.swing.table.*; 

public class adminlog extends javax.swing.JFrame { 

     

    /** Creates new form NewAccount */ 

    public adminlog() { 

        initComponents(); 

    } 

     

    /** This method is called from within the constructor to 

      initialize the form*/ 

     

    private void initComponents() { 

        jLabel1 = new javax.swing.JLabel(); 

        jLabel2 = new javax.swing.JLabel(); 

        jLabel6 = new javax.swing.JLabel(); 

        userid = new javax.swing.JTextField(); 

        password = new javax.swing.JPasswordField(); 

        update = new javax.swing.JButton(); 

(32)

Library Management System  Department of Information Technology, GIET, Gunupur 

        finish = new javax.swing.JButton(); 

 

        getContentPane().setLayout(null); 

 

        //setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 

     

 

 

setTitle("Admin log"); 

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); 

        jLabel1.setForeground(new java.awt.Color(102, 0, 0)); 

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 

        jLabel1.setText("USER ID:"); 

        getContentPane().add(jLabel1); 

        jLabel1.setBounds(20, 60, 120, 20); 

 

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); 

        jLabel2.setForeground(new java.awt.Color(102, 0, 0)); 

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 

        jLabel2.setText("PASSWORD:"); 

        getContentPane().add(jLabel2); 

        jLabel2.setBounds(20, 90, 120, 20); 

 

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 18)); 

        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 

        jLabel6.setText("ADMINISTRATOR LOGIN"); 

        getContentPane().add(jLabel6); 

        jLabel6.setBounds(50, 20, 300, 20); 

 

(33)

        userid.setFont(new java.awt.Font("Tahoma", 0, 14)); 

        getContentPane().add(userid); 

        userid.setBounds(170, 60, 130, 20); 

          password.setFont(new java.awt.Font("Tahoma", 0, 14));          getContentPane().add(password);          password.setBounds(170, 90, 130, 20); 

 

        update.setText("LOGIN"); 

 

 

update.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

     

 

 

 

 

 

if( userid.getText().equals("")) 

 

 

 

 

 

 

 

 

 

 

JOptionPane.showMessageDialog((Component) null, 

"Please Enter \n login and password ", "Login Error", 

JOptionPane.INFORMATION_MESSAGE); 

 

 

 

 

 

 

 

 

 

 

else{ 

 

 

 

 

 

//setVisible(false); 

 

 

 

 

 

//AdminPage ap=new AdminPage(); 

 

 

 

 

 

verifyAdmLogin(); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

        }); 

        update.setToolTipText("CLICK TO LOGIN"); 

(34)

Library Management System  Department of Information Technology, GIET, Gunupur 

        getContentPane().add(update); 

        update.setBounds(340, 60, 80, 30); 

 

        finish.setText("EXIT"); 

 

 

finish.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

    setVisible(false); 

 

 

 

 

 

LogPage llp=new LogPage(); 

 

 

 

 

 

        }); 

        finish.setToolTipText("CLICK TO EXIT"); 

        getContentPane().add(finish); 

        finish.setBounds(340, 100, 80, 30); 

 

        pack(); 

 

 

setSize(500,200); 

 

 

setVisible(true); 

 

 

setLocation(200,200); 

    } 

     

    /** 

     * @param args the command line arguments 

     */ 

    public static void main(String args[]) { 

        adminlog ad=new adminlog(); 

(35)

    } 

     

     

    private javax.swing.JButton finish; 

    private javax.swing.JLabel jLabel1; 

    

private javax.swing.JLabel jLabel2; 

    private javax.swing.JLabel jLabel6; 

    private javax.swing.JPasswordField password; 

    private javax.swing.JButton update; 

    private javax.swing.JTextField userid; 

    // End of variables declaration 

 

 

 

//******************************************* verify admin 

login************************************************** 

 

void verifyAdmLogin()  

 

 

 

 

 

 

Connection con=null; 

 

 

 

 

String url="jdbc:odbc:GIET"; 

 

 

 

 

Statement st=null; 

 

 

 

 

 

 

 

 

  try 

 

 

 

  { 

 

 

 

 

 

 

 

 

 

 

 

 

 String val1=userid.getText(); 

 

 

 

 

 

 

 val1=val1.trim(); 

 

 

 

 

 

String val2 =  (String)password.getText(); 

 

 

 

 

 

 

   val2 =  val2.trim(); 

(36)

Library Management System  Department of Information Technology, GIET, Gunupur 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 

 

 

 

 

 

 

 

 

 

    

 

con=DriverManager.getConnection(url); 

 

 

 

 

 

 

 

 

 

    

 

st = con.createStatement(); 

 

 

 

 

 

 

 

 

 

 

 

 

ResultSet rs=st.executeQuery("Select Passwd from adminlog 

where UserId='"+val1+"'"); 

 

 

 

 

 

 

 

 

 

while(rs.next()){ 

 

 

 

 

 

String user = rs.getString(1); 

 

 

 

 

 

System.out.println(user); 

 

 

 

 

 

 

 

 

 

 

 

boolean b=user.equals(val2); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if(b) 

 

 

 

 

 

 

 

 

 

 

setVisible(false); 

 

 

 

 

 

AdminPage aaa=new AdminPage(); 

 

 

 

 

 

 

 

 

 

 

 else 

(37)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                 

 

 

 

 

 

 

JOptionPane.showMessageDialog((Component) null, 

"Invalid password. \n Please enter again. ", "Login Error", 

JOptionPane.INFORMATION_MESSAGE); 

 

 

 

 

 

 

setVisible(false); 

 

 

 

 

 

 

adminlog alog=new adminlog(); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  } 

 

 

 

  catch(SQLException ex) 

 

 

 

   { 

 

 

 

    System.out.println("Unable to access the database"); 

 

 

 

   } 

 

 

 

  catch(ClassNotFoundException ex) 

 

 

 

   { 

 

 

 

    System.out.println("Class not found"); 

 

 

 

   } 

 

 

 

  catch(Exception ex) 

(38)

Library Management System  Department of Information Technology, GIET, Gunupur 

 

 

 

  { 

       System.out.println("Exception raised is:"+ex); 

 

 

 

  } 

 

 

 

  finally { 

 

 

 

  con=null; 

 

 

 

  } 

 

 

     

 

 

 

(39)

STAFF  LOGIN PAGE  SAMPLE  CODE 

/*NewAccount.java */ 

import java.awt.*; 

import java.awt.event.*; 

import javax.swing.*; 

import java.sql.*; 

import javax.swing.table.*; 

public class stafflog extends javax.swing.JFrame { 

     

    /** Creates new form NewAccount */ 

    public stafflog() { 

        initComponents(); 

    } 

     

    private void initComponents() { 

        jLabel1 = new javax.swing.JLabel(); 

        jLabel2 = new javax.swing.JLabel(); 

        jLabel6 = new javax.swing.JLabel(); 

        userid = new javax.swing.JTextField(); 

        password = new javax.swing.JPasswordField(); 

        update = new javax.swing.JButton(); 

        finish = new javax.swing.JButton(); 

 

        getContentPane().setLayout(null); 

 

 

(40)

Library Management System  Department of Information Technology, GIET, Gunupur 

        setTitle("STAFF LOG"); 

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); 

        jLabel1.setForeground(new java.awt.Color(102, 0, 0)); 

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 

        jLabel1.setText("USER ID:"); 

        getContentPane().add(jLabel1); 

        jLabel1.setBounds(20, 60, 120, 20); 

 

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); 

        jLabel2.setForeground(new java.awt.Color(102, 0, 0)); 

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 

        jLabel2.setText("PASSWORD:"); 

        getContentPane().add(jLabel2); 

        jLabel2.setBounds(20, 90, 120, 20); 

 

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 18)); 

        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 

        jLabel6.setText("STAFF LOGIN"); 

        getContentPane().add(jLabel6); 

        jLabel6.setBounds(50, 20, 300, 20); 

 

        userid.setFont(new java.awt.Font("Tahoma", 0, 14)); 

        getContentPane().add(userid); 

        userid.setBounds(170, 60, 130, 20); 

 

        password.setFont(new java.awt.Font("Tahoma", 0, 14)); 

(41)

        getContentPane().add(password); 

        password.setBounds(170, 90, 130, 20); 

 

        update.setText("LOGIN"); 

        update.setToolTipText("CLICK TO LOGIN"); 

 

 

update.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

     if( userid.getText().equals("")) 

 

 

 

 

 

 

 

 

 

 

JOptionPane.showMessageDialog((Component) null, "Plese 

Enter \n login and password ", "Login Error", JOptionPane.INFORMATION_MESSAGE); 

 

 

 

 

 

 

 

 

 

 

else{ 

 

 

 

 

 

 

verifystaffLogin(); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

        }); 

 

 

 

 

 

 

        getContentPane().add(update); 

        update.setBounds(340, 60, 80, 30); 

 

(42)

Library Management System  Department of Information Technology, GIET, Gunupur 

        finish.setText("EXIT"); 

 

 

finish.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

 

 

setVisible(false); 

 

 

 

 

    LogPage llp=new LogPage(); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

        }); 

        finish.setToolTipText("CLICK TO EXIT"); 

        getContentPane().add(finish); 

        finish.setBounds(340, 100, 80, 30); 

 

        pack(); 

 

 

setSize(500,200); 

 

 

setVisible(true); 

 

 

setLocation(200,200); 

    } 

    public static void main(String args[]) { 

        stafflog ad=new stafflog(); 

    } 

     

    // Variables declaration ‐ do not modify 

    private javax.swing.JButton finish; 

    private javax.swing.JLabel jLabel1; 

(43)

    private javax.swing.JLabel jLabel2; 

    private javax.swing.JLabel jLabel6; 

    private javax.swing.JPasswordField password; 

    private javax.swing.JButton update; 

    private javax.swing.JTextField userid; 

    // End of variables declaration 

     

 

void verifystaffLogin()  

 

 

 

 

 

 

Connection con=null; 

 

 

 

 

String url="jdbc:odbc:GIET"; 

 

 

 

 

Statement st=null; 

 

 

 

 

 

 

 

 

  try 

 

 

 

  { 

 

 

 

 

 

 

 

 

 

 

 

 

 String val1=userid.getText(); 

 

 

 

 

 

 

 val1=val1.trim(); 

 

 

 

 

 

String val2 =  (String)password.getText(); 

 

 

 

 

 

 

   val2 =  val2.trim(); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 

 

 

 

 

 

 

 

 

 

    

 

con=DriverManager.getConnection(url); 

(44)

Library Management System  Department of Information Technology, GIET, Gunupur 

 

 

 

 

 

 

 

 

 

    

 

st = con.createStatement(); 

 

 

 

 

 

 

 

 

 

 

 

 

ResultSet rs=st.executeQuery("Select Passwd from adminlog 

where UserId='"+val1+"'"); 

 

 

 

 

 

 

 

 

 

while(rs.next()){ 

 

 

 

 

 

String user = rs.getString(1); 

 

 

 

 

 

System.out.println(user); 

 

 

 

 

 

 

 

 

 

 

 

boolean b=user.equals(val2); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if(b) 

 

 

 

 

 

 

 

 

 

 

setVisible(false); 

 

 

 

 

 

LibrarianPage aaa=new LibrarianPage(); 

 

 

 

 

 

 

 

 

 

 

 else 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(45)

 

 

 

 

 

 

JOptionPane.showMessageDialog((Component) null, 

"Invalid Login name/password. Please enter again. ", "Login Error", 

JOptionPane.INFORMATION_MESSAGE); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  } 

 

 

 

  catch(SQLException ex) 

 

 

 

   { 

 

 

 

    System.out.println("Unable to access the database"); 

 

 

 

   } 

 

 

 

  catch(ClassNotFoundException ex) 

 

 

 

   { 

 

 

 

    System.out.println("Class not found"); 

 

 

 

   } 

 

 

 

  catch(Exception ex) 

 

 

 

  { 

       System.out.println("Exception raised is:"+ex); 

 

 

 

  } 

 

 

 

  finally { 

 

 

 

  con=null; 

 

 

 

  } 

(46)

Library Management System  Department of Information Technology, GIET, Gunupur 

 

 

 

 

 

 

 

 

(47)

LIBRARIAN  PAGE  SAMPLE  CODE 

// AdminPage.java 

  

import java.awt.*; 

import java.awt.event.*; 

import javax.swing.*; 

import java.sql.*; 

import javax.swing.table.*; 

public class LibrarianPage extends javax.swing.JFrame { 

     

    /** Creates new form AdminPage */ 

    public LibrarianPage() { 

        initComponents(); 

    } 

     

    private void initComponents() { 

        heading = new javax.swing.JLabel(); 

        heading1 = new javax.swing.JLabel(); 

        heading3 = new javax.swing.JLabel(); 

        heading5 = new javax.swing.JLabel(); 

        issuebook = new javax.swing.JButton(); 

        addbooks = new javax.swing.JButton(); 

        deletebooks = new javax.swing.JButton(); 

        reserve = new javax.swing.JButton(); 

(48)

Library Management System  Department of Information Technology, GIET, Gunupur 

        logout = new javax.swing.JButton(); 

        heading4 = new javax.swing.JLabel(); 

        heading6 = new javax.swing.JLabel(); 

        heading7 = new javax.swing.JLabel(); 

        returnbook = new javax.swing.JButton(); 

 

        getContentPane().setLayout(null); 

 

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 

        setTitle("LIBRARIAN  PAGE"); 

        setForeground(new java.awt.Color(254, 215, 3)); 

        heading.setFont(new java.awt.Font("Tahoma", 3, 18)); 

        heading.setForeground(new java.awt.Color(102, 0, 0)); 

        heading.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 

        heading.setText("CENTERAL LIBRARY GIET GUNUPUR."); 

        getContentPane().add(heading); 

        heading.setBounds(380, 20, 310, 30);

 

 

        heading1.setFont(new java.awt.Font("Tahoma", 3, 14)); 

        

heading1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 

        heading1.setText(" ISSUE BOOK  =>"); 

        getContentPane().add(heading1); 

        heading1.setBounds(110, 160, 210, 30); 

 

(49)

        heading3.setFont(new java.awt.Font("Tahoma", 3, 14)); 

        heading3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 

        heading3.setText("DELETE BOOK DETAIL =>"); 

        getContentPane().add(heading3); 

        heading3.setBounds(120, 380, 210, 30); 

 

        heading5.setFont(new java.awt.Font("Tahoma", 3, 14)); 

        

heading5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 

        heading5.setText("RESERVE BOOK    =>"); 

        getContentPane().add(heading5); 

        heading5.setBounds(130, 270, 210, 30); 

 

        issuebook.setText("ISSUE"); 

        issuebook.setToolTipText("Click to create new account"); 

 

 

issuebook.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

  issue iss=new issue(); 

 

 

 } 

        }); 

        getContentPane().add(issuebook); 

        issuebook.setBounds(380, 160, 120, 30); 

 

        addbooks.setText("ADD NEW BOOK"); 

(50)

Library Management System  Department of Information Technology, GIET, Gunupur 

        addbooks.setToolTipText("add new boooks"); 

 

 

addbooks.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

    //setVisible(false); 

 

 

 

 

 

NewBook nb=new NewBook(); 

 

 

      } 

        }); 

        getContentPane().add(addbooks); 

        addbooks.setBounds(390, 330, 120, 30); 

 

        deletebooks.setText("DELETE BOOK"); 

        deletebooks.setToolTipText("Delete book"); 

 

 

deletebooks.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

    //setVisible(false); 

 

 

 

 

 

DeleteBook db=new DeleteBook(); 

 

 

      } 

        }); 

        getContentPane().add(deletebooks)

        deletebooks.setBounds(390, 380, 120, 30); 

(51)

 

        reserve.setText("RESERVE"); 

        reserve.setToolTipText("reserve book"); 

 

 

reserve.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

   reservebook rb=new reservebook(); 

 

 

      } 

        }); 

        reserve.setFocusPainted(false); 

        getContentPane().add(reserve); 

        reserve.setBounds(380, 270, 120, 30); 

 

        logout.setFont(new java.awt.Font("Tahoma", 1, 14)); 

        logout.setText("LOGOUT"); 

 

 

logout.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

    setVisible(false); 

 

 

 

 

 

LogPage lp=new LogPage(); 

 

 

      } 

        

}); 

(52)

Library Management System  Department of Information Technology, GIET, Gunupur 

        getContentPane().add(logout); 

        logout.setBounds(550, 450, 100, 50); 

 

        heading4.setFont(new java.awt.Font("Tahoma", 3, 18)); 

        heading4.setForeground(new java.awt.Color(0, 102, 102)); 

        heading4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 

        heading4.setText("STAFF PAGE"); 

        getContentPane().add(heading4); 

        heading4.setBounds(30, 20, 310, 30); 

 

        heading6.setFont(new java.awt.Font("Tahoma", 3, 14)); 

        heading6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 

        heading6.setText("ADD NEW BOOKS  =>"); 

        getContentPane().add(heading6); 

        heading6.setBounds(120, 330, 210, 30); 

 

        heading7.setFont(new java.awt.Font("Tahoma", 3, 14)); 

        

heading7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 

        heading7.setText("RETURN BOOK =>"); 

        getContentPane().add(heading7); 

        heading7.setBounds(120, 220, 210, 30); 

 

        returnbook.setText("RETURN"); 

        returnbook.setToolTipText("click to return book"); 

(53)

 

 

 

    } 

returnbook.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

 

 

 

 

   returnb rrr=new returnb(); 

 

 

      } 

        }); 

        getContentPane().add(returnbook); 

        returnbook.setBounds(380, 220, 120, 30); 

 

        pack(); 

 

 

setSize(800,600); 

 

 

setLocation(50,50); 

 

 

setVisible(true); 

 

    public static void main(String args[]) { 

        LibrarianPage lp=new LibrarianPage(); 

    } 

     

    // Variables declaration ‐ do not modify 

    private javax.swing.JButton addbooks; 

    private javax.swing.JButton deletebooks; 

(54)

Library Management System  Department of Information Technology, GIET, Gunupur 

    private javax.swing.JLabel heading; 

    private javax.swing.JLabel heading1; 

    private javax.swing.JLabel heading3; 

    private javax.swing.JLabel heading4; 

    private javax.swing.JLabel heading5; 

    private javax.swing.JLabel heading6; 

    private javax.swing.JLabel heading7; 

    private javax.swing.JButton issuebook; 

    private javax.swing.JButton logout; 

    private javax.swing.JButton reserve; 

    private javax.swing.JButton returnbook; 

    // End of variables declaration 

     

 

 

 

(55)

LEAST BOOK PAGE OF SAMPLE CODE 

import java.awt.*; 

import java.awt.event.*; 

 

import javax.swing.*; 

 

import java.sql.*; 

 

public class ListBook extends JFrame{ 

 

 

private JPanel pBook = new JPanel (); 

 

private JTable table; 

 

private JScrollPane jsp; 

 

private Object data1[][]; 

 

private Container c; 

 

private JButton ok; 

 

int row=0; 

 

public ListBook() { 

 

 

 

pBook.setLayout (null); 

 

 

ok = new JButton ("ok"); 

 

 

ok.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

(56)

Library Management System  Department of Information Technology, GIET, Gunupur 

 

 

 

 

 

listbok(); 

 

 

 

 

 

 

 

 

 

 

 

        }); 

 

 

ok.setBounds (25, 175, 125, 25); 

 

 

pBook.add(ok); 

 

 

 

 

getContentPane().add (pBook, BorderLayout.CENTER); 

 

 

setSize(400,400); 

 

//setVisible (true); 

 

 

setLocation(200,200); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

public void listbok(){ 

 

 

 

 

 

 

 

 

 

 

Connection con=null; 

 

 

 

 

String url="jdbc:odbc:GIET"; 

 

 

 

 

Statement st=null; 

 

 

 

 

try {   

(57)

 

 

 

 

 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 

 

 

 

      con=DriverManager.getConnection(url); 

 

 

 

 

st = con.createStatement(); 

 

 

 

 

 

 

 

 

 

 

String q,bavl,bisr; 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ResultSet rss=st.executeQuery("SELECT * FROM bk "); 

 

 

while(rss.next()){ 

 

 

row++; 

 

 

 

 

 

System.out.println(row); 

 

 

 

 

 

 

 

 

 

 

data1=new Object[row][6]; 

 

 

 

 

System.out.println("hai"); 

 

 

 

 

Object[] Colheads={"Book id ","book name","book 

auther","book category","issued to","status"}; 

 

 

 

ResultSet rs = st.executeQuery ("SELECT * FROM bk ");

 

//Executing the Query. 

 

 

 

 

 

 

 

 

for(int i1=0;i1<row;i1++) 

 

 

 

 

 

 

 

 

 

 

rs.next(); 

 

 

 

 

 

 

for(int j1=0;j1<6;j1++) 

 

 

 

 

 

 

(58)

Library Management System  Department of Information Technology, GIET, Gunupur 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

data1[i1][j1]=rs.getString(j1+1); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

System.out.println(); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

table=new JTable(data1,Colheads); 

 

 

 

 

int 

v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; 

 

 

 

 

int 

h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; 

 

 

 

 

 

 

 

 

 

jsp=new JScrollPane(table,v,h); 

 

 

 

 

TableDisp td=new TableDisp(table); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

catch(Exception sqlex) { 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(59)

 

 

 

 

 

 

 

 

 

 

 

 

public static void main(String[] args){ 

 

 

 

ListBook lmm=new ListBook(); 

 

 

 

 

 

 

(60)

Library Management System  Department of Information Technology, GIET, Gunupur 

LIST  MEMBER PAGE SAMPLE  CODE 

import java.awt.*; 

import java.awt.event.*; 

 

import javax.swing.*; 

 

import java.sql.*; 

 

public class ListMembers extends JFrame{ 

 

 

private JPanel pBook = new JPanel (); 

 

private JTable table; 

 

private JScrollPane jsp; 

 

private Object data1[][]; 

 

private Container c; 

 

private JButton ok; 

 

int row=0; 

 

public ListMembers() { 

 

 

 

pBook.setLayout (null); 

 

 

ok = new JButton ("ok"); 

 

 

ok.addActionListener(new ActionListener(){ 

   

 

 

public void actionPerformed(ActionEvent evt) 

 

 

 

(61)

 

 

 

 

 

listmem(); 

 

 

 

 

 

 

 

 

 

 

 

        }); 

 

 

ok.setBounds (25, 175, 125, 25); 

 

 

pBook.add(ok); 

 

 

 

 

getContentPane().add (pBook, BorderLayout.CENTER); 

 

 

setSize(400,400); 

 

setVisible (true);  

 

setLocation(200,200); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

public void listmem(){ 

 

 

 

 

 

 

 

 

 

 

Connection con=null; 

 

 

 

 

String url="jdbc:odbc:GIET"; 

 

 

 

 

Statement st=null; 

 

 

 

 

try {   

(62)

Library Management System  Department of Information Technology, GIET, Gunupur 

 

 

 

 

 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 

 

 

 

      con=DriverManager.getConnection(url); 

 

 

 

 

st = con.createStatement(); 

 

 

 

 

 

 

 

 

 

 

String q,bavl,bisr; 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ResultSet rss=st.executeQuery("SELECT * FROM userdata "); 

 

 

while(rss.next()){ 

 

 

row++; 

 

 

 

 

 

System.out.println(row); 

 

 

 

 

 

 

 

 

 

 

data1=new Object[row][7]; 

 

 

 

 

System.out.println("hai"); 

 

 

 

 

Object[] 

Colheads={"useridno","username","gender","department","course","semester",

"NO_BOOK_TAKEN"}; 

 

 

 

ResultSet rs = st.executeQuery ("SELECT * FROM userdata ");

 

//Executing the Query. 

 

 

 

 

 

 

 

 

for(int i1=0;i1<row;i1++) 

 

 

 

 

 

 

 

 

 

 

rs.next(); 

 

 

 

 

 

 

for(int j1=0;j1<7;j1++) 

(63)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

data1[i1][j1]=rs.getString(j1+1); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

System.out.println(); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

table=new JTable(data1,Colheads); 

 

 

 

 

int 

v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; 

 

 

 

 

int 

h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; 

 

 

 

 

 

 

 

 

 

jsp=new JScrollPane(table,v,h); 

 

 

 

 

TableDisp td=new TableDisp(table); 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

catch(Exception sqlex) { 

 

 

 

 

 

 

 

 

 

 

 

// 

JOptionPane.showMessageDialog (this, "Some 

prob Found."); 

 

 

 

 

 

 

 

 

 

(64)

Library Management System  Department of Information Technology, GIET, Gunupur 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

public static void main(String[] args){ 

 

 

 

ListMembers lmm=new ListMembers(); 

 

 

 

 

 

 

 

References

Related documents