You are on page 1of 87

Table of Contents:

1. Introduction.

2. System Analysis.

3. System Design.

4. Data Flow Diagram.

5. System Implementation.

6. System Configuration.

7. Appendix.

8. Screen Shots.

9. Connectivity to Database.

10. Conclusion.

11. Further Enhancement.

12. Reference.

1|Page
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 32-bit

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


2|Page
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

3|Page
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.

4|Page
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

5|Page
All the manual difficulties in managing the Library have been rectified by

implementing computerization.

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.

6|Page
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. If 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 the organization .Therefore , the system is

economically feasible.

7|Page
DATA FLOW DIAGRAM

Context Diagram
Level 0:

SYSTEM REPORT
USER

8|Page
Level 1:

Add New
Book

Edit New Book

Remove Book
BOOK

Update Book

Search Book

Level 2:

9|Page
10 | P a g e
SYSTEM IMPLEMENTATION

Win32 programming tutorial is implementation specific to Windows

operating system, that is for 32 bit Windows operating system family. Now

we already have the 64 bit Windows Operating System such as, Windows

XP Professional x64 Edition. However the fundamentals in system

programming not much change, the general principle and concept still

retained. Based on the MSDN documentation but re-arranged in a readable

and understandable sequence, avoiding a lot of cross references, this tutorial

tries to investigate the Windows 2000 (NT5) family system through Win32

C programming. compiler used was Visual C++ .Net with no CLR

(unmanaged), otherwise mentioned and the platform is Windows XP Pro

with Service Pack 2. All program example uses console mode application.

The low-level programming of this tutorial tries to cover all the main part of

the Windows system from Files, Directory, Access Controls (security),

Registry, User and Group, Process and Thread up to the overall security

aspect of Windows Operating System. This tutorial contains hundreds

working program examples. If you don't understand what is discussed or lost

here, you should refer to the C/C++ Tutorial.  Some Windows kernel

information also provided and general info on the kernel implementation are

given in ppt which can be found on the right sidebar.

11 | P a g e
In the .NET programming, C++ .NET has been left for the system and native

programming, Microsoft is promoting the use of C# and VB .NET. We

found the .NET is nothing new, most of the features already implemented in

Java and 'similar feel' as Java. It is very beneficial for the Java programmer;

you should master .NET programming language family faster. For the 64

bits system, we can expect the Win64 programming. This Tutorial may be

the longest one combining the standard C and Microsoft extension to the

standard C. Well, don't be a hacker but be an 'ethical hacker’. Let hack,

hack, hack Windows OSes.

12 | P a g e
ABOUT THE LANGUAGE

JAVA is a programming language developed by Sun Microsystem and is

based on the concepts of C and C++. The syntax for java is similar to C.

13 | P a g e
HISTORY OF JAVA

Java was started as a project called "Oak" by James Gosling in June 1991.

Gosling's goals were to implement a virtual machine and a language that had

a familiar C-like notation but with greater uniformity and simplicity than

C/C++. The first public implementation was Java 1.0 in 1995. It made the

promise of "Write Once, Run Anywhere", with free runtimes on popular

platforms. It was fairly secure and its security was configurable, allowing for

network and file access to be limited. The major web browsers soon

incorporated it into their standard configurations in a secure "applet"

configuration. popular quickly. New versions for large and small platforms

(J2EE and J2ME) soon were designed with the advent of "Java 2". Sun has

not announced any plans for a "Java 3".

Features of Java FEATURES

There is given many features of java. They are also known as java

buzzwords. The Java Features given below are simple and easy to

understand.

14 | P a g e
1. Simple

2. Object-Oriented

3. Platform independent

4. Secured

5. Robust

6. Architecture neutral

7. Portable

8. Dynamic

9. Interpreted

10.High Performance

11.Multithreaded

12.Distributed

Simple

According to Sun, Java language is simple because:


      Syntax is based on C++ (so easier for programmers to learn it after C++).
removed many confusing and/or rarely-used features e.g., explicit pointers,

operator overloading etc.


      No need to remove unreferenced objects because there is Automatic

Garbage Collection in java.

15 | P a g e
Object-oriented

Object-oriented means we organize our software as a combination

of different types of objects that incorporates both data and

behaviour.
Object-oriented programming(OOPs) is a methodology that

simplify software development and maintenance by providing some

rules.
Basic concepts of OOPs are:
1. Object

2. Class

3. Inheritance

4. Polymorphism

5. Abstraction

6. Encapsulation

Platform Independent

A platform is the hardware or software environment in which a program

runs. There are two types of platforms software-based and hardware-based.

Java provides software-based platform. The Java platform differs from most

other platforms in the sense that it's a software-based platform that runs on

16 | P a g e
top of other hardware-based platforms. It has two components:

1. Runtime Environment

2. API(Application Programming Interface)

Java code can be run on multiple platforms e.g.Windows,Linux,Sun

Solaris,Mac/OS etc. Java code is compiled by the compiler and converted

into bytecode.This bytecode is a platform independent code because it can

be run on multiple platforms i.e. Write Once and Run Anywhere (WORA).

Secured

Java is secured because:


 No explicit pointer

 Programs run inside virtual machine sandbox.

 Classloader- adds security by separating the package for the classes

of the local file system from those that are imported from network

sources.

 Bytecode Verifier- checks the code fragments for illegal code that

can violate access right to objects.

 Security Manager- determines what resources a class can access

17 | P a g e
such as reading and writing to the local disk.

These securities are provided by java language. Some security can also be

provided by application developer through SSL,JAAS,cryptography etc.

Robust

Robust simply means strong. Java uses strong memory management. There

are lack of pointers that avoids security problem. There is automatic garbage

collection in java. There is exception handling and type checking mechanism

in java. All these points makes java robust.

Architecture-neutral

There are no implementation dependent features e.g. size of primitive types

is set.

Portable

We may carry the java bytecode to any platform.

High-performance

Java is faster than traditional interpretation since byte code is "close" to

native code still somewhat slower than a compiled language (e.g., C++)

Distributed

We can create distributed applications in java. RMI and EJB are used for

18 | P a g e
creating distributed applications. We may access files by calling the methods

from any machine on the internet.

Multi-threaded

A thread is like a separate program, executing concurrently. We can write

Java programs that deal with many tasks at once by defining multiple

threads. The main advantage of multi-threading is that it shares the same

memory. Threads are important for multi-media, Web applications etc.

SYSTEM CONFIGURATION

SOFTWARE CONFIGURATION

Operating System: Windows NT,

Windows 98,

Windows XP.

Language: Java 2 Runtime Environment Database : MS

Access2007

19 | P a g e
HARDWARE CONFIGURATION

PROCESSOR : Intel Pentium 2.4 Ghz

RAM : Minimum 128 MB

HDD : Minimum 80 GB

PRINTER

KEYBORD : 103 Keys (any)

20 | P a g e
ABOUT MS-ACCESS

Microsoft Access has been around for some time, yet people often still ask

me what is Microsoft Access and what does it do? Microsoft Access is a part

of the Microsoft Office Suite. It does not come with all versions of

Microsoft Office, so if you specifically want Microsoft Access make sure

the office suite you are purchasing has it.

Microsoft Access has the look and feel of other Microsoft Office products,

including its layout and navigational aspects. That is where the similarity

21 | P a g e
ends. Microsoft® Access is a database and, more specifically, a relational

database. This will be explained in more detail later.

Access has an .mdb extension by default, whereas Microsoft® Word has

the .doc extension. Although this has changed in Access 2007 where the

extension is now an accdb extension. Early versions of Access cannot read

accdb extensions but Microsoft Access 2007 can read and change earlier

versions of Access. The above is a bried overview of what is Microsoft

Access. Now lets look at it in a bit more detail.

What is Microsoft Access made up of?

The Microsoft® Access Database is made up of 7 major components:

 Tables;

 Relationships;

 Queries;

 Forms;

 Reports;

 Macros;

 Modules.

22 | P a g e
The following gives a quick overview of each component.

Tables

The tables are the backbone and the storage container of the data entered

into the database. If the tables are not set up correctly, with the correct

relationships, then the database may be slow, give you the wrong results or

not react the way you expect. So, take a bit of time when setting up your

tables.

Queries, forms, etc. are usually based on a table.

The tables that contain data look a bit like a table in Microsoft® Word or a

Microsoft® Excel Spreadsheet, when opened. They have columns and rows

as does a table in Microsoft® Word and an Excel worksheet. Each of the

columns will have a field name at the top and each of the rows will represent

a record.

As an example:

23 | P a g e
Relationships

Relationships are the bonds you build between the tables. They join tables

that have associated elements. To do this there is a field in each table, which

is linked to each other, and have the same values.

Queries

Are the means of manipulating the data to display in a form or a report.

Queries can sort, calculate, group, filter, join tables, update data, delete data,

etc. Their power is immense. The Microsoft® Access database query

language is SQL (Structured Query Language). The need to know SQL is

not required in the early stages of learning Access. Microsoft® Access

writes the SQL for you, after you tell it what you want, in the Design view

of the queries window.

Forms

Forms are the primary interface through which the users of the database

enter data. The person who enters the data will interact with forms regularly.

The programmer can set the forms to show only the data required. By using

24 | P a g e
queries, properties, macros and VBA (Visual Basic for Applications), the

ability to add, edit and delete data can also be set. Forms can be set up and

developed to reflect the use they will be required for.

Reports

Reports are the results of the manipulation of the data you have entered into

the database. Unlike forms, they cannot be edited. Reports are intended to be

used to output data to another device or application, i.e. printer, fax,

Microsoft® Word or Microsoft® Excel.

Macros

Macros are an automatic way for Access to carry out a series of actions for

the database. Access gives you a selection of actions that are carried out in

the order you enter. Macros can open forms; run queries, change values of a

field, run other Macros, etc. the list is almost endless.

Modules

25 | P a g e
Modules are the basis of the programming language that supports

Microsoft® Access, The module window is where you can write and store

Visual Basic for Applications (VBA). Advanced users of Microsoft®

Access tend to use VBA instead of Macros.

APPENDIX

SOURCE CODE

ProjectLibrary.java

import java.io.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;
26 | P a g e
import javax.swing.JPopupMenu;

import com.sun.java.swing.plaf.motif.MotifLookAndFeel;

public class ProjectLibrary extends JFrame implements ActionListener

JTextField

id,phno,name,add,city,padd,eadd,class1,shift,progress,date;

JTextField bookTF,authorTF,priceTF,bcodeTF;

JTextField cdcodeTF,cdtitleTF,cdisbnTF,cdeditionTF,cdpubTF;

Container c;

JButton search,save,delete,exit,update;

JButton searBook,saveNow,update1;

JButton cdsearch,cdsave,cddelete,cdexit,cdupdate;

JLabel cdlogo,cdcode,cdtitle,cdisbn,cdedit,cdpub;

JOptionPane jp = new JOptionPane();

JMenuBar menuBar,menuBar1;

JMenu menu1,menu2;

JMenuItem

menuItemN,menuItemB,menuItemC,menuItemH,menuItemA,menuItemE;

Cursor cur;

27 | P a g e
public ProjectLibrary()

super("Library Record System");

c = getContentPane(); c.setBackground(new Color(14,58,119));

c.setLayout(null);

setBounds(0,0,850,590);

setFont(new Font("verdana",3,14));

cur = new Cursor(Cursor.CROSSHAIR_CURSOR);

setCursor(cur);

ImageIcon coll = new ImageIcon("collicon.gif");

JLabel LogoColl = new JLabel(coll);

menuBar = new JMenuBar();

menu1 = new JMenu("Library");

menu1.setBackground(Color.white);

menu1.setMnemonic('L');

menu2 = new JMenu("Help");

menu2.setMnemonic('H');

menu2.setBackground(Color.white);

//menu1.setMnemonic(KeyEvent.VK_D);

28 | P a g e
menuItemN = new JMenuItem("New",new

ImageIcon("NEW.GIF")); menuItemN.setBackground(Color.white);

menuItemN.setMnemonic('N');

menuItemB = new JMenuItem("Books",new

ImageIcon("b.gif")); menuItemB.setBackground(Color.white);

menuItemB.setMnemonic('B');

menuItemC = new JMenuItem("CD's",new

ImageIcon("cd.PNG"));menuItemC.setBackground(Color.white);

menuItemC.setMnemonic('C');

menuItemE = new JMenuItem("Exit",new

ImageIcon("Exit.PNG")); menuItemE.setBackground(Color.white);

menuItemE.setMnemonic('E');

menuItemH = new JMenuItem("Help library",new

ImageIcon("help.gif")); menuItemH.setBackground(Color.white);

menuItemH.setMnemonic('E');

menuItemA = new JMenuItem("About LRS");

setJMenuBar(menuBar);

JLabel lDate = new JLabel("Issue Of Date :");

lDate.setForeground(Color.white);
29 | P a g e
JLabel ph = new JLabel("Enter Phone Number :");

ph.setForeground(Color.white);

JLabel lname = new JLabel("Student's Name :");

lname.setForeground(Color.white);

JLabel address = new JLabel("Student's Address :");

address.setForeground(Color.white);

JLabel lid = new JLabel("Book Code");

lid.setForeground(Color.white);

JLabel lcity = new JLabel("City");

lcity.setForeground(Color.white);

JLabel pad = new JLabel("Cource");

pad.setForeground(Color.white);

JLabel leadd = new JLabel("Email Address");

leadd.setForeground(Color.white);

JLabel lclass = new JLabel("Class");

lclass.setForeground(Color.white);

JLabel lshift = new JLabel("Session");

lshift.setForeground(Color.white);

30 | P a g e
JLabel lprogress = new JLabel("Branch");

lprogress.setForeground(Color.white);

ImageIcon next = new ImageIcon("next.gif");

JLabel next1 = new JLabel(next);

ImageIcon previous = new ImageIcon("Back.gif");

JLabel previous1 = new JLabel(previous);

ImageIcon background = new ImageIcon("backg.jpg");

JLabel img = new JLabel(background);

ImageIcon college = new ImageIcon("Movie1.PNG");

JLabel colLogo = new JLabel(college);

ImageIcon LineStraight = new ImageIcon("lineh.gif");

JLabel Line = new JLabel(LineStraight);

date = new JTextField(); date.setForeground(Color.black);

date.setBackground(Color.white);

phno = new JTextField(); phno.setForeground(Color.black);

phno.setBackground(Color.white);

31 | P a g e
name = new JTextField(); name.setForeground(Color.black);

name.setBackground(Color.white);

add = new JTextField(); add.setForeground(Color.black);

add.setBackground(Color.white);

eadd = new JTextField();

eadd.setForeground(Color.black); eadd.setBackground(Color.white);

city = new JTextField();

city.setForeground(Color.black); city.setBackground(Color.white);

padd = new JTextField();

padd.setForeground(Color.black); padd.setBackground(Color.white);

id = new JTextField();

id.setForeground(Color.black); id.setBackground(Color.white);

class1 = new JTextField();

class1.setForeground(Color.black);

class1.setBackground(Color.white);

shift = new JTextField();

shift.setForeground(Color.black); shift.setBackground(Color.white);

32 | P a g e
progress = new JTextField();

progress.setForeground(Color.black);

progress.setBackground(Color.white);

search = new JButton("Search",new ImageIcon("search.gif"));

search.setForeground(Color.white); search.setBackground(Color.pink);

save = new JButton("Save", new ImageIcon("Save.gif"));

save.setForeground(Color.white); save.setBackground(Color.pink);

delete = new JButton("Delete", new ImageIcon("remove.gif"));

delete.setForeground(Color.white); delete.setBackground(Color.pink);

exit = new JButton("Exit", new ImageIcon("EXIT.PNG"));

exit.setForeground(Color.white); exit.setBackground(Color.pink);

update = new JButton("Update", new ImageIcon("update.gif"));

update.setForeground(Color.white); update.setBackground(Color.pink);

search.setToolTipText("Search the record");

save.setToolTipText("Save the record");

delete.setToolTipText("Delete the record");

exit.setToolTipText("Exit from the library");

update.setToolTipText("Update the record");

33 | P a g e
lDate.setBounds(80,135,670,150);

LogoColl.setBounds(380,20,670,150);

lid.setBounds(80,240,150,20);

ph.setBounds(400,245,150,20);

lname.setBounds(80,285,150,20);

address.setBounds(400,290,150,20);

lcity.setBounds(400,330,150,20);

pad.setBounds(400,375,150,20);

leadd.setBounds(400,415,150,20);

lclass.setBounds(80,330,150,20);

lshift.setBounds(80,380,150,20);

lprogress.setBounds(80,415,150,20);

next1.setBounds(650,478,180,54);

previous1.setBounds(10,478,190,54);

img.setBounds(90,100,20,40);

colLogo.setBounds(3,0,790,142);

Line.setBounds(2,2,48,1000);

date.setBounds(220,190,152,26);

id.setBounds(220,235,152,26);

34 | P a g e
phno.setBounds(550,245,152,26);

name.setBounds(220,280,152,26);

add.setBounds(550,290,152,26);

city.setBounds(550,330,152,26);

padd.setBounds(550,370,152,26);

eadd.setBounds(550,410,152,26);

class1.setBounds(220,325,152,26);

shift.setBounds(220,370,152,26);

progress.setBounds(220,415,152,26);

search.setBounds(160,490,105,30);

save.setBounds(270,490,90,30);

delete.setBounds(363,490,95,30);

update.setBounds(460,490,110,30);

exit.setBounds(575,490,95,30);

menu1.add(menuItemN);

menu1.add(menuItemB);

menu1.add(menuItemC);

menu1.add(menuItemE);

menuBar.add(menu1);

menu2.add(menuItemH);

35 | P a g e
menu2.add(menuItemA);

menuBar.add(menu2);

save.addActionListener(this);

search.addActionListener(this);

delete.addActionListener(this);

update.addActionListener(this);

exit.addActionListener(this);

menuItemN.addActionListener(this);

menuItemB.addActionListener(this);

menuItemC.addActionListener(this);

menuItemH.addActionListener(this);

menuItemA.addActionListener(this);

menuItemE.addActionListener(this);

c.add(search);

c.add(save );

c.add(delete);

c.add(exit);

c.add(update);

c.add(LogoColl);

c.add(lDate);

36 | P a g e
c.add(ph);

c.add(lname);

c.add(address);

c.add(lid);

c.add(lcity);

c.add(pad);

c.add(leadd);

c.add(lclass);

c.add(lshift);

c.add(lprogress);

c.add(next1);

c.add(previous1);

c.add(img);

c.add(colLogo);

c.add(date);

c.add(phno);

c.add(name);

c.add(add);

c.add(city);

c.add(padd);

37 | P a g e
c.add(id);

c.add(eadd);

c.add(class1);

c.add(progress);

c.add(shift);

c.add(Line);

next1.addMouseListener(new MouseAdapter()

public void mousePressed(MouseEvent me)

int a = Integer.parseInt(id.getText());

a++;

try

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

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();
38 | P a g e
ResultSet rs = st.executeQuery("select * from

Directory where Id="+a);

while(rs.next())

date.setText(rs.getString("DateToday"));

id.setText(rs.getString("Id"));

name.setText(rs.getString("Name"));

add.setText(rs.getString("Address"));

class1.setText(rs.getString("Class"));

progress.setText(rs.getString("Progress"));

shift.setText(rs.getString("Shift"));

city.setText(rs.getString("City"));

padd.setText(rs.getString("Permenent_Address"));

phno.setText(rs.getString("PhoneNo"));

eadd.setText(rs.getString("eaddress"));
39 | P a g e
}

c.close();

st.close();

catch(ClassNotFoundException cnf)

System.out.println("Cnf Exception");

catch(SQLException sql)

System.out.println(sql);

});

previous1.addMouseListener(new MouseAdapter()

public void mousePressed(MouseEvent me)


40 | P a g e
{

int a = Integer.parseInt(id.getText());

a--;

try

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

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

ResultSet rs = st.executeQuery("select * from

Directory where Id="+a);

while(rs.next())

date.setText(rs.getString("DateToday"));

id.setText(rs.getString("Id"));

name.setText(rs.getString("Name"));

add.setText(rs.getString("Address"));

class1.setText(rs.getString("Class"));

41 | P a g e
progress.setText(rs.getString("Progress"));

shift.setText(rs.getString("Shift"));

city.setText(rs.getString("City"));

padd.setText(rs.getString("Permenent_Address"));

phno.setText(rs.getString("PhoneNo"));

eadd.setText(rs.getString("eaddress"));

c.close();

st.close();

catch(ClassNotFoundException cnf)

System.out.println("Cnf Exception");

catch(SQLException sql)

System.out.println(sql);
42 | P a g e
}

});

setDefaultCloseOperation(EXIT_ON_CLOSE);

setVisible(true);

public void actionPerformed(ActionEvent ae)

String str1=(String)ae.getActionCommand();

Object source = ae.getSource();

if(source==menuItemA)

JFrame aboutus = new JFrame("About us");

aboutus.setSize(700,500);

aboutus.getContentPane().setLayout(null);

ImageIcon design = new ImageIcon("about.png");

JLabel cover = new JLabel(design);

aboutus.getContentPane().add(cover);

cover.setBounds(5,0,685,500);

43 | P a g e
aboutus.setVisible(true);

if(source==menuItemN)

id.setEditable(true);

phno.setEditable(true);

name.setEditable(true);

add.setEditable(true);

city.setEditable(true);

padd.setEditable(true);

eadd.setEditable(true);

class1.setEditable(true);

shift.setEditable(true);

progress.setEditable(true);

date.setEditable(true);

id.setText(null);

phno.setText(null);

name.setText(null);

add.setText(null);

44 | P a g e
city.setText(null);

padd.setText(null);

eadd.setText(null);

class1.setText(null);

shift.setText(null);

progress.setText(null);

date.setText(null);

if(source==menuItemB)

JFrame book=new JFrame("Book's available in

library");

book.setSize(660,560);

book.getContentPane().setLayout(null);

book.getContentPane().setBackground(new

Color(14,58,119));

book.getContentPane().setForeground(Color.white);

book.setResizable(false);

JLabel BookName = new JLabel("Book Name:");

45 | P a g e
book.getContentPane().add(BookName);

JLabel AuthorName = new JLabel("Author

Name:");

book.getContentPane().add(AuthorName);

JLabel Pri = new JLabel("Price:");

book.getContentPane().add(Pri);

JLabel Bcode = new JLabel("Book Code:");

book.getContentPane().add(Bcode);

bookTF = new JTextField(10);

book.getContentPane().add(bookTF);

authorTF = new JTextField(10);

book.getContentPane().add(authorTF);

priceTF = new JTextField(5);

book.getContentPane().add(priceTF);

bcodeTF = new JTextField(5);

book.getContentPane().add(bcodeTF);

ImageIcon logobook = new

ImageIcon("logoBook.jpg");

46 | P a g e
JLabel logoBook = new JLabel(logobook);

book.getContentPane().add(logoBook);

searBook = new JButton("Search", new

ImageIcon("SEARCH.PNG"));

book.getContentPane().add(searBook);

saveNow = new JButton("Save", new

ImageIcon("SAVE.PNG"));

book.getContentPane().add(saveNow);

update1 = new JButton("Update", new

ImageIcon("UPDATE.PNG"));

book.getContentPane().add(update1);

logoBook.setBounds(0,0,650,171);

Bcode.setBounds(33,200,112,30);

BookName.setBounds(33,250,112,30);

AuthorName.setBounds(30,310,112,30);

Pri.setBounds(31,370,112,30);

bcodeTF.setBounds(123,200,100,20);

bookTF.setBounds(123,255,262,20);
47 | P a g e
authorTF.setBounds(123,315,262,20);

priceTF.setBounds(123,375,100,20);

saveNow.setBounds(280,500,111,30);

update1.setBounds(400,500,111,30);

searBook.setBounds(160,500,111,30);

saveNow.addActionListener(this);

update1.addActionListener(this);

searBook.addActionListener(this);

book.setVisible(true);

if(source==menuItemE)

System.exit(0);

jp = new JOptionPane();

if(source==saveNow)

try

48 | P a g e
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

PreparedStatement ps =

c.prepareStatement("Insert into Book values(?,?,?,?)");

ps.setString(1,bcodeTF.getText());

ps.setString(2,bookTF.getText());

ps.setString(3,authorTF.getText());

ps.setString(4,priceTF.getText());

ps.executeUpdate();

jp.showMessageDialog(this,"Record

Inserted Successfully","SUCCESS",jp.INFORMATION_MESSAGE);

c.close();

st.close();

catch(ClassNotFoundException cnf)

{System.out.println("Cnf Exception");}
49 | P a g e
catch(SQLException sql)

{jp.showMessageDialog(this,"Record Already

Exists","EXCEPTION",jp.ERROR_MESSAGE);}

if(source==update1)

try

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

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

PreparedStatement ps=c.prepareStatement

("Update Book set BookName=? , AuthorName=? , Price=? where

BookCode="+bcodeTF.getText() );

ps.setString(1,bookTF.getText());

ps.setString(2,authorTF.getText());

50 | P a g e
ps.setInt(3,Integer.parseInt(priceTF.getText()));

ps.executeUpdate();

jp.showMessageDialog(this,"Record Updated

Successfully","SUCCESS",jp.INFORMATION_MESSAGE);

c.close();

st.close();

catch(ClassNotFoundException cnf)

{System.out.println("Cnf Exception");}

catch(SQLException sql)

{jp.showMessageDialog(this,sql,"EXCEPTION",jp.ERROR_MESSAGE);}

if(source==menuItemC)

JFrame cd=new JFrame("CD's available in

library");

cd.setSize(510,540);

cd.getContentPane().setLayout(null);

51 | P a g e
cd.getContentPane().setBackground(new

Color(14,58,119));

cd.getContentPane().setLayout(null);

cd.setResizable(false);

ImageIcon backg = new

ImageIcon("CDLABEL.PNG");

JLabel cdlogo = new JLabel(backg);

cd.getContentPane().add(cdlogo);

cdcode = new JLabel("CD Code:");

cdcode.setForeground(Color.white);

cdtitle = new JLabel("Title:");

cdtitle.setForeground(Color.white);

cdisbn = new JLabel("ISBN NO:"); cdisbn

.setForeground(Color.white);

cdedit = new JLabel("Edition:"); cdedit

.setForeground(Color.white);

cdpub = new JLabel("Publication:");cdpub

.setForeground(Color.white);

52 | P a g e
cdcodeTF = new JTextField();

cdtitleTF = new JTextField();

cdisbnTF = new JTextField();

cdeditionTF = new JTextField();

cdpubTF = new JTextField();

cdsearch = new JButton("Search" , new

ImageIcon("SEARCH.PNG"));

cdsave = new JButton("Save", new

ImageIcon("SAVE.PNG"));

cddelete = new JButton("Delete", new

ImageIcon("DELETE.PNG"));

cdupdate = new JButton("Update", new

ImageIcon("UPDATE.PNG"));

cdexit = new JButton("Exit", new

ImageIcon("EXIT.PNG"));

cd.getContentPane().add(cdcode);

cd.getContentPane().add(cdtitle);

cd.getContentPane().add(cdisbn);

cd.getContentPane().add(cdedit);
53 | P a g e
cd.getContentPane().add(cdpub);

cd.getContentPane().add(cdcodeTF);

cd.getContentPane().add(cdtitleTF);

cd.getContentPane().add(cdisbnTF);

cd.getContentPane().add(cdeditionTF);

cd.getContentPane().add(cdpubTF);

cd.getContentPane().add(cdsearch);

cd.getContentPane().add(cdsave);

cd.getContentPane().add(cddelete);

cd.getContentPane().add(cdupdate);

cd.getContentPane().add(cdexit);

cdlogo.setBounds(1,0,500,100);

cdcode.setBounds(50,120,210,25);

cdtitle.setBounds(50,160,210,25);

cdisbn.setBounds(50,200,210,25);

cdedit.setBounds(50,240,210,25);

cdpub.setBounds(50,280,210,25);

54 | P a g e
cdcodeTF.setBounds(150,120,210,25);

cdtitleTF.setBounds(150,160,210,25);

cdisbnTF.setBounds(150,200,210,25);

cdeditionTF.setBounds(150,240,210,25);

cdpubTF.setBounds(150,280,210,25);

cdsearch.setBounds(0,420,98,25);

cdsave.setBounds(100,420,98,25);

cddelete.setBounds(200,420,98,25);

cdupdate.setBounds(300,420,98,25);

cdexit.setBounds(400,420,98,25);

cdsearch.addActionListener(this);

cdsave.addActionListener(this);

cddelete.addActionListener(this);

cdexit.addActionListener(this);

cdupdate.addActionListener(this);

cd.setVisible(true);

55 | P a g e
if(source==cdsearch)

try

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

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

ResultSet rs = st.executeQuery("select *

from CD where CdCode="+cdcodeTF.getText());

while(rs.next())

cdtitleTF.setText(rs.getString("Title"));

cdisbnTF.setText(rs.getString("IsbnNO"));

cdeditionTF.setText(rs.getString("Edition"));

cdpubTF.setText(rs.getString("Publication"));

56 | P a g e
}

c.close();

st.close();

catch(ClassNotFoundException cnf)

jp.showMessageDialog(this,cnf,"EXCEPTION",jp.ERROR_MESSAGE);

System.out.println("Cnf Exception");

catch(SQLException sql)

jp.showMessageDialog(this,sql,"EXCEPTION",jp.ERROR_MESSAGE);

if(source==cdsave)

{
57 | P a g e
try

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

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

PreparedStatement ps = c.prepareStatement("Insert

into CD values(?,?,?,?,?)");

ps.setString(1,cdcodeTF.getText());

ps.setString(2,cdtitleTF.getText());

ps.setString(3,cdisbnTF.getText());

ps.setString(4,cdeditionTF.getText());

ps.setString(5,cdpubTF.getText());

ps.executeUpdate();

jp.showMessageDialog(this,"Record Inserted

Successfully","SUCCESS",jp.INFORMATION_MESSAGE);

c.close();

st.close();

58 | P a g e
}

catch(ClassNotFoundException cnf)

System.out.println("Cnf Exception");

catch(SQLException sql)

jp.showMessageDialog(this,"Record Already

Exists","EXCEPTION",jp.ERROR_MESSAGE);

if(source==cddelete)

try

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

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();
59 | P a g e
PreparedStatement ps=c.prepareStatement("Delete

from CD where CdCode="+cdcodeTF.getText());

ps.executeUpdate();

jp.showMessageDialog(this,"Record Deleted

Successfully","SUCCESS",jp.INFORMATION_MESSAGE);

c.close();

st.close();

catch(ClassNotFoundException cnf)

System.out.println("Cnf Exception");

catch(SQLException sql)

jp.showMessageDialog(this,sql,"EXCEPTION",jp.ERROR_MESSAGE);

60 | P a g e
if(source==cdupdate)

try

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

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

PreparedStatement ps=c.prepareStatement ("Update CD

set Title=?, IsbnNO=?, Edition=?, Publication=? where

CdCode="+cdcodeTF.getText());

ps.setString(1,cdtitleTF.getText());

ps.setString(2,cdisbnTF.getText());

ps.setString(3,cdeditionTF.getText());

ps.setString(4,cdpubTF.getText());

ps.executeUpdate();

jp.showMessageDialog(this,"Record Updated

Successfully","SUCCESS",jp.INFORMATION_MESSAGE);

c.close();

61 | P a g e
st.close();

catch(ClassNotFoundException cnf)

System.out.println("Cnf Exception");

catch(SQLException sql)

jp.showMessageDialog(this,sql,"EXCEPTION",jp.ERROR_MESSAGE);

if(source==cdexit)

System.exit(0);

if(source==menuItemH)

JFrame help=new JFrame("Help ?");

62 | P a g e
help.setSize(800,730);

help.getContentPane().setBackground(new

Color(14,58,119));

help.getContentPane().setLayout(null);

help.setResizable(false);

ImageIcon hl = new ImageIcon("helpLib.png");

JLabel logoCD = new JLabel(hl);

help.getContentPane().add(logoCD);

logoCD.setBounds(0,0,800,540);

help.setVisible(true);

if(source==searBook)

try

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

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

63 | P a g e
ResultSet rs = st.executeQuery("select * from Book

where BookCode="+bcodeTF.getText());

while(rs.next())

bookTF.setText(rs.getString("BookName"));

authorTF.setText(rs.getString("AuthorName"));

priceTF.setText(rs.getString("Price"));

/*add.setText(rs.getString("Address"));

class1.setText(rs.getString("Class"));

progress.setText(rs.getString("Progress"));

phno.setText(rs.getString("PhoneNo"));

shift.setText(rs.getString("Shift"));

city.setText(rs.getString("City"));

padd.setText(rs.getString("Permenent_Address"));

eadd.setText(rs.getString("eaddress"));*/

c.close();

st.close();

}
64 | P a g e
catch(ClassNotFoundException cnf)

jp.showMessageDialog(this,cnf,"EXCEPTION",jp.ERROR_MESSAGE);

System.out.println("Cnf Exception");

catch(SQLException sql)

jp.showMessageDialog(this,sql,"EXCEPTION",jp.ERROR_MESSAGE);

if(str1.equals("Search"))

try

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

65 | P a g e
Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

ResultSet rs = st.executeQuery("select * from Directory

where Id="+id.getText());

while(rs.next())

{ date.setText(rs.getString("DateToday"));

id.setText(rs.getString("Id"));

name.setText(rs.getString("Name"));

add.setText(rs.getString("Address"));

class1.setText(rs.getString("Class"));

progress.setText(rs.getString("Progress"));

phno.setText(rs.getString("PhoneNo"));

shift.setText(rs.getString("Shift"));

city.setText(rs.getString("City"));

padd.setText(rs.getString("Permenent_Address"));

eadd.setText(rs.getString("eaddress"));

}
66 | P a g e
c.close();

st.close();

catch(ClassNotFoundException cnf)

jp.showMessageDialog(this,cnf,"EXCEPTION",jp.ERROR_MESSAGE);

System.out.println("Cnf Exception");

catch(SQLException sql)

jp.showMessageDialog(this,sql,"EXCEPTION",jp.ERROR_MESSAGE);

if(str1.equals("Save"))

try

{
67 | P a g e
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

PreparedStatement ps = c.prepareStatement("Insert

into Directory values(?,?,?,?,?,?,?,?,?,?,?)");

ps.setString(1,date.getText());

ps.setString(2,id.getText());

ps.setString(3,name.getText());

ps.setString(4,class1.getText());

ps.setString(5,shift.getText());

ps.setString(6,progress.getText());

ps.setString(7,add.getText());

ps.setString(8,city.getText());

ps.setString(9,padd.getText());

ps.setString(10,phno.getText());

ps.setString(11,eadd.getText());

ps.executeUpdate();

68 | P a g e
jp.showMessageDialog(this,"Record Inserted

Successfully","SUCCESS",jp.INFORMATION_MESSAGE);

c.close();

st.close();

catch(ClassNotFoundException cnf)

System.out.println("Cnf Exception");

catch(SQLException sql)

jp.showMessageDialog(this,"Record Already

Exists","EXCEPTION",jp.ERROR_MESSAGE);

if(str1.equals("Delete"))

try

69 | P a g e
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

PreparedStatement ps=c.prepareStatement("Delete

from Directory where Id="+id.getText());

ps.executeUpdate();

jp.showMessageDialog(this,"Record Deleted

Successfully","SUCCESS",jp.INFORMATION_MESSAGE);

c.close();

st.close();

catch(ClassNotFoundException cnf)

System.out.println("Cnf Exception");

catch(SQLException sql)

jp.showMessageDialog(this,sql,"EXCEPTION",jp.ERROR_MESSAGE);

70 | P a g e
}

if(str1.equals("Update"))

try

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

Connection c =

DriverManager.getConnection("jdbc:odbc:Student");

Statement st = c.createStatement();

//PreparedStatement ps=c.prepareStatement ("Update

Directory set

Date=?,Name=?,Class=?,Shift=?,Progress=?,Address=?,City=?,Permenent_

Address=?,PhoneNo=?,eaddress=? where Id="+id.getText());

PreparedStatement ps=c.prepareStatement ("Update Directory

set Name=?, Class=?, Shift=?, Progress=?, Address=?, City=?,

Permenent_Address=?, PhoneNo=?, eaddress=?, DateToday=? where

Id="+id.getText());

71 | P a g e
ps.setString(1,name.getText());

ps.setString(2,class1.getText());

ps.setString(3,shift.getText());

ps.setString(4,progress.getText());

ps.setString(5,add.getText());

ps.setString(6,city.getText());

ps.setString(7,padd.getText());

ps.setString(8,phno.getText());

ps.setString(9,eadd.getText());

ps.setString(10,date.getText());

ps.executeUpdate();

jp.showMessageDialog(this,"Record Updated

Successfully","SUCCESS",jp.INFORMATION_MESSAGE);

c.close();

st.close();

catch(ClassNotFoundException cnf)

System.out.println("Cnf Exception");

72 | P a g e
catch(SQLException sql)

jp.showMessageDialog(this,sql,"EXCEPTION",jp.ERROR_MESSAGE);

if(str1.equals("Exit"))

System.exit(0);

public static void main(String arg[])

ProjectLibrary p4 = new ProjectLibrary();

p4.setResizable(false);

SNAPSHOTS
73 | P a g e
Main Page

74 | P a g e
Issue Books Page

75 | P a g e
Help Diary Page

76 | P a g e
About Page

77 | P a g e
Search Page

78 | P a g e
Add New Page

79 | P a g e
Connectivity

Domain : Library Management System

Before you compile the project you have to set the Jdbc/Odbc Connection

then it will work properly

Let us see How to set ODBC connection with MS-Access.

80 | P a g e
Configuring the Microsoft Access ODBC Data Source

You will find the ODBC Administrator within Administrative Tools from

your Control Panel.

81 | P a g e
From here you will create your new System DSN. Click the Add button and

then select the Microsoft Access Driver and click Finish.

82 | P a g e
Give your DSN a meaningful name and click Select. Here you will be able

to browse to your existing .mdb file.

Once you have selected the database you want to access, click OK and then

OK again to exit the dialog box. You have now created your data source.

This will open the JOB Web Administrator where you have many

configuration options. On the left hand side, you will see a Test Applet link.

This will show you a box with various parameters. The Logon User and

Password should be the same as your valid Windows details.

Once you have entered your username and password, click the Connect

button. This will then display a pop-up box:

As you can see from the image, we have created a system DSN that points to

northwind.mdb called NORTHWIND. (There is a Northwind database

included in most versions of Microsoft Office.) If you have more than one

83 | P a g e
system DSN, your newly created DSN will appear at the bottom of the drop

down list.

From here, simply select the DSN you wish to connect to and click Connect.

(You will not need to add a database username and password as the Access

database will use NT authentication.)

Once connected, you will see a list of tables. You can issue a simple select *

from table by double clicking the table you wish to query. Alternatively, you

can issue your own SQL in the SQL field.

This will return the result set in an applet window:

84 | P a g e
Conclusion and future enhancement

This project was developed to fulfill user and business requirement; however

there are lots of scopes to improve the performance of the Library

Management System in the area of user interface, database performance, and

query processing time. Etc.

So there are many things for future enhancement of this project. The future

enhancements that are possible in the project are as follows.

 Linking and integration of any legacy system for accounting.

 Integration with bank database through Web Services

 Connection to third-party OLAP applications

 Implement Bar code reader

 Web interface for members

 In the area of data security and system security.

 Provide more online tips and help.

 To optimize the query which is embedded in the system?

85 | P a g e
REFERENCE

Websites

 http://www.google.com

 http://www.microsoft.com

 http://www.programmer2programmer.net

 http://www.codeproject.com

 http://www.msdn.com.

 http://www.vb123.com

 http://www.vbcode.com

 http://www.sqltuner.com

86 | P a g e
Books

 Java 2 Complete Reference.

 Core Java 2 Seventh Edition by Cay S. Horstmenn and Cary Cornell

 Advanced Java by E Balaguruswamy.

 Programming using Java by David. J ECK.

 Core Design Patterns by James W. Cooper.

87 | P a g e

You might also like