Professional Documents
Culture Documents
BCA Library Management System
BCA Library Management System
Certificate
This is to certify that the dissertation entitled “Library Management System” carried out by
Mr. Harish Bhati, student of BACHELORS'S IN COMPUTER APPLICATION [2011-
2014], of College of Education Bilaspur, is hereby accepted and approved as a credible work.
Submitted in the partial fulfillment for the requirement of degree of BCA. It’s a bona fide record
of the work done by him under my supervision during his stay as a project trainee at Winner-
Gize Technology Pvt. Ltd. from Jan 10, 2014 to May 25, 2014. The system has been
implemented and running successfully.
I, PRASHANT KUUMAR, hereby declare that the project work entitled “Library
Management System” is an authenticated work carried out by me at WINNER-
GIZE TECHNOLOGY PVT. LTD. Under the guidance of H O D- Hemant
Upadhyay for the partial fulfillment of the award of the degree of BACHELORS'S OF
COMPUTER APPLICATIONS and this work has not been submitted for similar
purpose anywhere else except to College of Education Bilaspur
1. Introduction
1.1 Abstract
1.2 Objective
1.3 Scope/Need of Project
2. Feasibility Study
3. Software Requirements Specification
3.1 Introduction
3.2 Selection of Technology/Specific Requirements
4. Design
4.1 ER Diagram
4.2 Data Flow Diagram
4.3 Modules
4.4 Database
4.5 Input-Output Form(Screen Layout)
5. Coding
6. Implementation Environment
7. Testing & Result
8. Enhancement
9. Limitations
10. Conclusion
11. Bibliography/References
Borrowing books, returning books or viewing the available books at the Library of the local
University is currently done manually where in the student has to go to the Library and
check the available books at the Library. Students check the list of books available and
borrow the books if the book is a borrow book otherwise it is of waste for the student to
come to the library to come to check for the books if the student doesn’t get the book. Then
the librarian checks the student id and allows the member to check out the book and the
librarian then updates the member database and also the books database. This takes at least
one to two hours if the member is available at the near by place otherwise it may take more
time.
We have decided to investigate the use of an Online Library Management System. This
system would be used by members who may be students or professors of that University to
check the availability of the books and borrow the books, and by the librarian to update the
databases. The purpose of this document is to analyze and elaborate on the high-level needs
and features of the Library Management System. It focuses on the capabilities and facilities
provided by a Library. The details of what all are the needs of the Library Management
System and if it fulfils these needs are detailed in the use-case and supplementary
specifications.
1.1 ABSTRACT
Prime Goal
Today in this fast moving world, everything is directly/indirectly managed through computing
systems which helps to save time, money and environment. This project has been developed to do
all of these and added to that, provide the user with a simple and interactive user interface so a non-
technical person can also use the project for his/her work.
A feasibility study is conducted to objectively and rationally uncover the strengths and weaknesses
of the existing business or proposed venture, opportunities and threats as presented by the
environment, the resources required to carry through, and ultimately the prospects for success.
The key considerations in feasibility analysis are:
Economic Feasibility
The proposed project is economically feasible because the cost involved in purchasing the hardware
and the software are within approachable limits. The personal costs like gathering of graphics and
design are also nominal, because images and graphics are freely available on the internet. The
operating environment costs are marginal. The less time involved also helped in its economic
feasibility.
This project reduces the administrative and operational cost. Because of the reduction in the use of
paper, use of labour, cost also reduces.
Time Saving Benefits
It saves lots of time and provides you with informational resources. Processing time is minimal
which keeps the records up-to-date all the time.
Environmental Benefits
Loads of paper and space is saved which can be used to do some other work and saving paper is
the most essential in keeping out environment green and keep us healthy also.
The project is technically feasible as the hardware and software resources required are easily
available. Development and maintenance of the project is also not complex/large scale task.
3.1 Introduction
This project has been developed to simplify the current manual system of library
management system and also at the same time to reduce the time and cost to run the current
system. Besides saving time and cost, this project may also reduce the use of precious paper
which is itself a huge contribution to the environment. The personnel managing this project
would also have to learn about using computer machines which are used everywhere in this
world now.
3.1.1 Purpose
The product provides the members with online blocking of books capabilities and
the Library System is up and running all day.
The system provides logon facility to the users.
The system provides the members with the option to check their account and/or
change their options like password of the account whenever needed all through the
day during the library hours.
The system allows the members to block the books 24 hours a day and all the
through the semester.
The system lets the library staff to check which all members have blocked the books
and whether they can borrow any more books or not.
The system allows the Librarian to create the books catalog, add/delete books and
maintain the books catalog.
The system updates the billing system as and when the member borrows or returns a
book.
The book catalog is automated and the decision of offering the book based on the
category of the book is automatically decided.
We also have an order department, which manages to add or remove a book from the
Library.
3.2.3 Reliability
The system has to be very reliable due to the importance of data and the damages incorrect or
incomplete data can do.
3.2.4 Availability
The system is available 100% for the user and is used 24 hrs a day and 365 days a year. The
system shall be operational 24 hours a day and 7 days a week.
3.2.5 Accuracy
The accuracy of the system is limited by the accuracy of the speed at which the employees of
the library and users of the library use the system.
3.3 Performance
3.3.1 Response Time
The Splash Page or Information page should be able to be downloaded within a minute
using a 56K modem. The information is refreshed every two minutes. The access time for a
mobile device should be less than a minute. The system shall respond to the member in not
less than two seconds from the time of the request submittal. The system shall be allowed to
take more time when doing large processing jobs.
The languages that shall be used for coding the Online Library System are Active Server
Pages (ASP), Java Servlets, Java Server Pages (JSP), HTML, JavaScript, and VBScript. For
working on the coding phase of the Online Library System, the Internet Information
Services (IIS) Server needs to be installed.
Will make use of the available Java Development Tool kits for working with Java Beans
and Java Server Pages. Also will make use of the online references available for developing
programs in ASP, HTML and the two scripting languages, JavaScript and VBScript.
Will make use of the existing Java libraries available for JSP and Servlets. Also we need to
develop some new libraries for the web-based application. Also will develop new programs
using ASP and scripting languages.
STUDENTSINFO
Ha
s
ISSUE INFO
Ha
s
STUDENTSINFO
BOOKS
1.1
BOOKS Details Data Save Into Table
Add
BOOK
Id
STUDENT
User_ID
USERS
4.6 Modules
1. MainScreen.java
DATA TABLES
STUDENTS INFO
BOOKSINFO
1. MainScreen.java
Coding:
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.sql.SQLException;
import javax.imageio.ImageIO;
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
/**
*
*/
privatestaticfinallongserialVersionUID = 1L;
JPanel rightPanel;
JPanel leftPanel;
JButton exitButton;
JButton aboutButton;
JButton studentsButton;
JButton booksButton;
JButton issuesButton;
JPanel studentsPanel;
JButton addStudents;
JButton viewStudents;
JButton searchStudents;
JPanel booksPanel;
JButton addBooks;
JButton viewBooks;
JButton searchBooks;
JPanel issuesPanel;
JButton addIssues;
JButton viewIssues;
public MainScreen() {
// TODO Auto-generated constructor stub
//leftPanel
leftPanel = new LPanel();
leftPanel.setPreferredSize(prefleftSize);
leftPanel.setBorder(BorderFactory.createEmptyBorder(150, 50, 200, 50));
//BoxLayout on leftPanel
BoxLayout box = new BoxLayout(leftPanel, BoxLayout.Y_AXIS);
leftPanel.setLayout(box);
studentsButton.setPreferredSize(buttonSize);
booksButton.setPreferredSize(buttonSize);
issuesButton.setPreferredSize(buttonSize);
exitButton.setPreferredSize(buttonSize);
aboutButton.setPreferredSize(buttonSize);
//Menu Panels
//Menu Buttons
j1.add(studentsButton);
j2.add(booksButton);
j3.add(issuesButton);
j4.add(aboutButton);
j5.add(exitButton);
leftPanel.add(j1);
leftPanel.add(j2);
leftPanel.add(j3);
leftPanel.add(j4);
leftPanel.add(j5);
//Right Panel
rightPanel = new RPanel();
rightPanel.setPreferredSize(prefrightSize);
rightPanel.setOpaque(false);
sj1.add(addStudents);
sj1.setOpaque(false);
sj2.add(viewStudents);
sj2.setOpaque(false);
sj3.add(searchStudents);
sj3.setOpaque(false);
//Student Panel
studentsPanel = new JPanel();
studentsPanel.setOpaque(false);
studentsPanel.setLayout(new BoxLayout(studentsPanel, BoxLayout.Y_AXIS));
studentsPanel.setVisible(false);
studentsPanel.add(sj1);
studentsPanel.add(sj2);
studentsPanel.add(sj3);
ij1.add(addIssues);
ij2.add(viewIssues);
ij3.add(searchIssues);
//Issue Panel
issuesPanel = new JPanel();
issuesPanel.setOpaque(false);
issuesPanel.setLayout(new BoxLayout(issuesPanel, BoxLayout.Y_AXIS));
issuesPanel.setVisible(false);
issuesPanel.add(ij1);
issuesPanel.add(ij2);
issuesPanel.add(ij3);
rightPanel.add(booksPanel);
rightPanel.add(studentsPanel);
rightPanel.add(issuesPanel);
frame.add(leftPanel);
frame.add(rightPanel);
frame.getContentPane().add(BorderLayout.WEST, leftPanel);
frame.getContentPane().add(BorderLayout.EAST, rightPanel);
exitButton.addActionListener(this);
booksButton.addActionListener(this);
studentsButton.addActionListener(this);
issuesButton.addActionListener(this);
aboutButton.addActionListener(this);
addStudents.addActionListener(this);
addBooks.addActionListener(this);
addIssues.addActionListener(this);
viewBooks.addActionListener(this);
viewStudents.addActionListener(this);
frame.pack();
frame.setVisible(true);
}
/**
* @param args
*/
publicstaticvoid main(String[] args) {
// TODO Auto-generated method stub
@Override
publicvoid actionPerformed(ActionEvent ae) {
// TODO Auto-generated method stub
if(ae.getSource()==exitButton)
{
setVisible(false);
dispose();
System.exit(0);
}
if(ae.getSource()==booksButton){
booksPanel.setVisible(true);
studentsPanel.setVisible(false);
issuesPanel.setVisible(false);
if(ae.getSource()==studentsButton){
booksPanel.setVisible(false);
studentsPanel.setVisible(true);
issuesPanel.setVisible(false);
if(ae.getSource()==issuesButton){
booksPanel.setVisible(false);
studentsPanel.setVisible(false);
issuesPanel.setVisible(true);
if(ae.getSource()==addStudents){
new AddStudents();
if(ae.getSource()==addBooks){
new AddBooks();
if(ae.getSource()==addIssues){
new AddIssues();
if(ae.getSource()==viewBooks){
try {
new ViewBooks();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(ae.getSource()==viewStudents){
try {
new ViewStudents();
} catch (SQLException | ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
new ViewIssues();
} catch (ClassNotFoundException | SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(ae.getSource()==searchStudents){
new SearchStudents();
if(ae.getSource()==searchBooks){
new SearchBooks();
if(ae.getSource()==searchIssues){
new SearchIssues();
}
}
/**
*
*/
privatestaticfinallongserialVersionUID = 1L;
publicvoid paintComponent(Graphics g)
{
Image bgimage = null;
try {
bgimage =
ImageIO.read(getClass().getResource("images/leftpanelbg.jpg"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
super.paintComponent(g);
if( bgimage!= null)
{
g.drawImage(bgimage, 0, 0, this.getWidth(), this.getHeight(),
this);
/**
*
*/
privatestaticfinallongserialVersionUID = 1L;
publicvoid paintComponent(Graphics g)
{
Image bgimage = null;
try {
bgimage =
ImageIO.read(getClass().getResource("images/rightpanelbg.jpg"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
super.paintComponent(g);
if( bgimage!= null)
{
g.drawImage(bgimage, 0, 0, this.getWidth(), this.getHeight(),
this);
}
}
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
publicclass AddStudents {
JPanel rollnoPanel;
JPanel stunamePanel;
JPanel branchPanel;
JPanel booksissuedPanel;
JPanel latefeePanel;
JPanel decisionPanel;
String query;
public AddStudents() {
// TODO Auto-generated constructor stub
super();
final JFrame frame = new JFrame("ADD STUDENTS");
frame.setSize(screensize);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:odbc:LIBMGMT", "root", "pass");
Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
statement.executeUpdate(query);
statement.close();
conn.close();
JOptionPane.showMessageDialog(new JFrame(),"Database
Updated Successfully!");
}
catch(SQLException e){
System.out.print("SQL Exception : "+ e);
}
catch(ClassNotFoundException e){
System.out.print("ClassNotFoundException : "+ e);
}
}
});
JButton cancelButton = new JButton("CANCEL");
cancelButton.addActionListener(new ActionListener() {
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
frame.dispose();
}
});
decisionPanel.add(addButton);
decisionPanel.add(cancelButton);
frame.add(mainPanel);
frame.setVisible(true);
}
Coding:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
publicclass AddBooks {
JPanel detailsPanel;
JPanel booksnoPanel;
JPanel booksisbnPanel;
JPanel titlePanel;
JPanel authorPanel;
JPanel subjectPanel;
JPanel publisherPanel;
JPanel editionPanel;
JPanel copiesPanel;
JPanel pricePanel;
JPanel decisionPanel;
public AddBooks(){
super();
final JFrame frame = new JFrame("ADD BOOKS");
frame.setSize(screensize);
detailsPanel.add(booksnoPanel);
detailsPanel.add(booksisbnPanel);
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:odbc:LIBMGMT", "root", "pass");
Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
statement.executeUpdate(query);
JOptionPane.showMessageDialog(new JFrame(),"Database
Updated Successfully!");
frame.dispose();
}
catch(SQLException e){
}
catch(ClassNotFoundException e){
System.out.print("ClassNotFoundException : "+ e);
}
}
});
JButton cancelButton = new JButton("CANCEL");
cancelButton.addActionListener(new ActionListener() {
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
frame.dispose();
}
});
decisionPanel.add(addButton);
decisionPanel.add(cancelButton);
mainPanel.add(mainLabel);
mainPanel.add(new JPanel());
mainPanel.add(detailsPanel);
mainPanel.add(new JPanel());
mainPanel.add(titlePanel);
mainPanel.add(new JPanel());
mainPanel.add(authorPanel);
mainPanel.add(new JPanel());
mainPanel.add(subjectPanel);
mainPanel.add(new JPanel());
mainPanel.add(publisherPanel);
mainPanel.add(new JPanel());
mainPanel.add(editionPanel);
mainPanel.add(new JPanel());
mainPanel.add(copiesPanel);
mainPanel.add(new JPanel());
mainPanel.add(pricePanel);
frame.add(mainPanel);
frame.setVisible(true);
}
3. AddIssues.java
Coding:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
publicclass AddIssues {
JPanel booknoPanel;
JPanel titlePanel;
JPanel recieverPanel;
JPanel issueToPanel;
JPanel rollnoPanel;
JPanel issueDatePanel;
JPanel dueDatePanel;
JPanel returnDatePanel;
JPanel decisionPanel;
JTextField booknoField;
JTextField titleField;
public AddIssues(){
super();
final JFrame frame = new JFrame("ADD ISSUES");
frame.setSize(screensize);
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:odbc:LIBMGMT", "root", "pass");
Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
statement.executeUpdate(query);
statement.close();
conn.close();
JOptionPane.showMessageDialog(new JFrame(),"Database
Updated Successfully!");
}
catch(SQLException e){
System.out.print("SQL Exception : "+ e);
}
catch(ClassNotFoundException e){
System.out.println("ClassNotFoundException : "+ e);
}
}
});
JButton cancelButton = new JButton("CANCEL");
cancelButton.addActionListener(new ActionListener() {
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
frame.dispose();
}
});
decisionPanel.add(addButton);
decisionPanel.add(cancelButton);
mainPanel.add(mainLabel);
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(recieverPanel);
mainPanel.add(new JPanel());
mainPanel.add(booknoPanel);
mainPanel.add(new JPanel());
mainPanel.add(titlePanel);
mainPanel.add(new JPanel());
4. ViewStudents.java
Coding:
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
publicclass ViewStudents {
JPanel rollnoPanel;
JPanel stunamePanel;
JPanel branchPanel;
JPanel booksissuedPanel;
JPanel latefeePanel;
JPanel decisionPanel;
JTable issuesTable;
decisionPanel.add(prevButton);
decisionPanel.add(nextButton);
decisionPanel.add(closeButton);
frame.add(mainPanel);
frame.setVisible(true);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
nextButton.addActionListener(new ActionListener() {
issuesTable.setValueAt("", i, j);
}
}
try {
if(rs.next()){
rollnoField.setText(Integer.toString(rs.getInt(1)));
stunameField.setText(rs.getString(2));
branchField.setText(rs.getString(3));
booksissuedField.setText(Integer.toString(rs.getInt(4)));
latefeeField.setText(Integer.toString(rs.getInt(5)));
}
else{
JOptionPane.showMessageDialog(new
JFrame(), "No more records to display.");
}
while(tablers.next()){
issuesTable.setValueAt(tablers.getString(2), i, 1);
issuesTable.setValueAt(tablers.getString(5), i, 2);
issuesTable.setValueAt(tablers.getString(6), i, 3);
issuesTable.setValueAt(tablers.getString(7), i, 4);
tablers.next();
}
tablers.close();
tableStatement.close();
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
prevButton.addActionListener(new ActionListener() {
try {
if(rs.previous()){
rollnoField.setText(Integer.toString(rs.getInt(1)));
stunameField.setText(rs.getString(2));
branchField.setText(rs.getString(3));
booksissuedField.setText(Integer.toString(rs.getInt(4)));
latefeeField.setText(Integer.toString(rs.getInt(5)));
}
else{
JOptionPane.showMessageDialog(new
JFrame(), "No more records to display.");
}
String tablequery = "SELECT * FROM ISSUESINFO
WHERE ISSUEDROLLNO = "+ Integer.parseInt(rollnoField.getText())+ ";";
ResultSet tablers = null;
try {
tablers =
tableStatement.executeQuery(tablequery);
} catch (SQLException e1) {
while(tablers.previous()){
issuesTable.setValueAt(tablers.getString(1), i, 0);
issuesTable.setValueAt(tablers.getString(2), i, 1);
issuesTable.setValueAt(tablers.getString(5), i, 2);
issuesTable.setValueAt(tablers.getString(6), i, 3);
issuesTable.setValueAt(tablers.getString(7), i, 4);
tablers.previous();
}
tablers.close();
tableStatement.close();
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
closeButton.addActionListener(new ActionListener() {
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try {
statement.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
frame.dispose();
}
});
Coding:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
publicclass ViewBooks {
JPanel detailsPanel;
JPanel booksnoPanel;
JPanel booksisbnPanel;
College of Education Bilaspur Page 57
JPanel titlePanel;
JPanel authorPanel;
JPanel subjectPanel;
JPanel publisherPanel;
JPanel editionPanel;
JPanel copiesPanel;
JPanel pricePanel;
JPanel decisionPanel;
super();
final JFrame frame = new JFrame("VIEW BOOKS");
frame.setSize(screensize);
detailsPanel.add(booksnoPanel);
detailsPanel.add(booksisbnPanel);
decisionPanel.add(prevButton);
decisionPanel.add(nextButton);
decisionPanel.add(closeButton);
mainPanel.add(mainLabel);
mainPanel.add(new JPanel());
mainPanel.add(detailsPanel);
mainPanel.add(new JPanel());
mainPanel.add(titlePanel);
mainPanel.add(new JPanel());
mainPanel.add(authorPanel);
mainPanel.add(new JPanel());
mainPanel.add(subjectPanel);
mainPanel.add(new JPanel());
mainPanel.add(publisherPanel);
mainPanel.add(new JPanel());
mainPanel.add(editionPanel);
mainPanel.add(new JPanel());
mainPanel.add(copiesPanel);
mainPanel.add(new JPanel());
mainPanel.add(pricePanel);
mainPanel.add(new JPanel());
mainPanel.add(decisionPanel);
frame.add(mainPanel);
frame.setVisible(true);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
final Connection conn = DriverManager.getConnection("jdbc:odbc:LIBMGMT",
"root", "pass");;
final Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);;
String query = "SELECT * FROM BOOKSINFO";
final ResultSet rs = statement.executeQuery(query);
nextButton.addActionListener(new ActionListener() {
try {
if(rs.next()){
copiesField.setText(Integer.toString(rs.getInt(8)));
priceField.setText(Float.toString(rs.getFloat(9)));
}
else{
JOptionPane.showMessageDialog(new
JFrame(), "No more records to display.");
}
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
prevButton.addActionListener(new ActionListener() {
try {
if(rs.previous()){
booksnoField.setText(Integer.toString(rs.getInt(1)));
booksisbnField.setText(rs.getString(2));
titleField.setText(rs.getString(3));
authorField.setText(rs.getString(4));
subjectField.setText(rs.getString(5));
publisherField.setText(rs.getString(6));
editionField.setText(rs.getString(7));
copiesField.setText(Integer.toString(rs.getInt(8)));
priceField.setText(Float.toString(rs.getFloat(9)));
}
else{
JOptionPane.showMessageDialog(new
JFrame(), "No more records to display.");
}
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
closeButton.addActionListener(new ActionListener() {
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try {
statement.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
frame.dispose();
}
});
}
Coding:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
publicclass ViewIssues {
JPanel booknoPanel;
JPanel titlePanel;
JPanel recieverPanel;
JPanel issueToPanel;
JPanel rollnoPanel;
JPanel issueDatePanel;
JPanel dueDatePanel;
JPanel returnDatePanel;
JPanel decisionPanel;
JButton prevButton;
JButton nextButton;
JButton closeButton;
JTextField booknoField;
JTextField titleField;
JTextField issueToField;
JTextField rollnoField;
JTextField returnStatusField;
JTextField dueDateField;
JTextField issueDateField;
super();
frame = new JFrame("VIEW ISSUES");
frame.setSize(screensize);
decisionPanel.add(prevButton);
decisionPanel.add(nextButton);
decisionPanel.add(closeButton);
mainPanel.add(mainLabel);
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
frame.add(mainPanel);
frame.setVisible(true);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
final Connection conn = DriverManager.getConnection("jdbc:odbc:LIBMGMT",
"root", "pass");;
final Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);;
String query = "SELECT * FROM ISSUESINFO";
final ResultSet rs = statement.executeQuery(query);
prevButton.addActionListener(new ActionListener() {
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try {
if(rs.previous()){
booknoField.setText(Integer.toString(rs.getInt(1)));
titleField.setText(rs.getString(2));
rollnoField.setText(Integer.toString(rs.getInt(3)));
issueToField.setText(rs.getString(4));
issueDateField.setText(rs.getString(5));
dueDateField.setText(rs.getString(6));
returnStatusField.setText(rs.getString(7));
}
else{
JOptionPane.showMessageDialog(new JFrame(), "No
more records to display.");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
nextButton.addActionListener(new ActionListener() {
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try {
if(rs.next()){
booknoField.setText(Integer.toString(rs.getInt(1)));
titleField.setText(rs.getString(2));
rollnoField.setText(Integer.toString(rs.getInt(3)));
issueToField.setText(rs.getString(4));
issueDateField.setText(rs.getString(5));
dueDateField.setText(rs.getString(6));
returnStatusField.setText(rs.getString(7));
}
else{
JOptionPane.showMessageDialog(new JFrame(), "No
more records to display.");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
closeButton.addActionListener(new ActionListener() {
@Override
publicvoid actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
try {
statement.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
frame.dispose();
}
});
7. SearchStudents.java
Coding:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.DefaultCellEditor;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableColumn;
JPanel rollnoPanel;
JPanel stunamePanel;
JPanel branchPanel;
JPanel booksissuedPanel;
JPanel latefeePanel;
JPanel decisionPanel;
JTable issuesTable;
JFrame frame;
JTextField rollnoField ;
JTextField stunameField;
JButton searchButton;
JButton deleteButton;
JButton updateButton;
JButton closeButton;
JButton saveButton;
public SearchStudents() {
// TODO Auto-generated constructor stub
super();
frame = new JFrame("SEARCH STUDENTS");
frame.setSize(screensize);
decisionPanel.add(searchButton);
decisionPanel.add(updateButton);
decisionPanel.add(saveButton);
decisionPanel.add(deleteButton);
decisionPanel.add(closeButton);
frame.add(mainPanel);
frame.setVisible(true);
searchButton.addActionListener(this);
updateButton.addActionListener(this);
saveButton.addActionListener(this);
deleteButton.addActionListener(this);
closeButton.addActionListener(this);
}
@Override
publicvoid actionPerformed(ActionEvent ae) {
// TODO Auto-generated method stub
if(ae.getSource()==searchButton){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Connection conn = null;
Statement statement = null;
try {
conn =
DriverManager.getConnection("jdbc:odbc:LIBMGMT", "root", "pass");
statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ResultSet rs = null;
try {
rs = statement.executeQuery(query);
if(rs.next()){
rollnoField.setText(Integer.toString(rs.getInt(1)));
stunameField.setText(rs.getString(2));
branchCombo.setSelectedItem((rs.getString(3)));
booksissuedField.setText(Integer.toString(rs.getInt(4)));
latefeeField.setText(Float.toString(rs.getFloat(5)));
}
else{
JOptionPane.showMessageDialog(new JFrame(),
"Record not found!");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Statement tableStatement = null;
try {
tableStatement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
} catch (SQLException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
};
String tablequery = "SELECT * FROM ISSUESINFO WHERE
ISSUEDROLLNO = "+ Integer.parseInt(rollnoField.getText())+ ";";
ResultSet tablers = null;
try {
tablers = tableStatement.executeQuery(tablequery);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
while(tablers.next()){
issuesTable.setValueAt(tablers.getString(1), i, 0);
issuesTable.setValueAt(tablers.getString(2), i, 1);
issuesTable.setValueAt(tablers.getString(5), i, 2);
issuesTable.setValueAt(tablers.getString(6), i, 3);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
tablers.close();
tableStatement.close();
statement.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(ae.getSource()==updateButton){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Connection conn = null;
Statement statement = null;
try {
conn = DriverManager.getConnection("jdbc:odbc:LIBMGMT",
"root", "pass");
statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ResultSet rs = null;
try {
rs = statement.executeQuery(query);
if(rs.next()){
rollnoField.setText(Integer.toString(rs.getInt(1)));
stunameField.setText(rs.getString(2));
branchCombo.setSelectedItem((rs.getString(3)));
rollnoField.setEnabled(false);
stunameField.setEnabled(true);
branchCombo.setEnabled(true);
booksissuedField.setEnabled(true);
latefeeField.setEnabled(true);
saveButton.setVisible(true);
}
else{
JOptionPane.showMessageDialog(new JFrame(), "Record
not found!");
}
statement.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(ae.getSource()==saveButton){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:odbc:LIBMGMT", "root", "pass");
Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query = "UPDATE STUDENTSINFO SET STNAME = '"+
stunameField.getText()+ "', STBRANCH = '"+ branchCombo.getSelectedItem().toString()+
"', ISSUEDBOOKSNO = "+
Integer.parseInt(booksissuedField.getText())+ ", LATEFEE = "+
Float.parseFloat(latefeeField.getText())+
" WHERE STROLLNO = "+
Integer.parseInt(rollnoField.getText())+ ";";
statement.executeUpdate(query);
statement.close();
conn.close();
}
catch(ClassNotFoundException e){
System.out.print("ClassNotFound : "+ e);
}
catch(SQLException e1){
System.out.print("SQL Exception : "+ e1);
rollnoField.setEnabled(true);
stunameField.setEnabled(false);
branchCombo.setEnabled(false);
booksissuedField.setEnabled(false);
latefeeField.setEnabled(false);
saveButton.setVisible(false);
if(ae.getSource()==deleteButton){
if(confirm==JOptionPane.YES_OPTION){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:odbc:LIBMGMT", "root", "pass");
Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query = "DELETE FROM STUDENTSINFO WHERE
STROLLNO = "+ Integer.parseInt(rollnoField.getText())+ ";";
statement.executeUpdate(query);
statement.close();
conn.close();
}
catch(ClassNotFoundException e){
System.out.print("ClassNotFoundException : "+ e);
}
catch(SQLException e1){
System.out.print("SQL Exception : "+ e1);
}
if(ae.getSource()==closeButton){
frame.dispose();
8. SearchBooks.java
Coding:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
JFrame frame;
JPanel detailsPanel;
JPanel booksnoPanel;
JPanel booksisbnPanel;
JPanel titlePanel;
JPanel authorPanel;
JPanel subjectPanel;
JPanel publisherPanel;
JPanel editionPanel;
JPanel copiesPanel;
College of Education Bilaspur Page 76
JPanel pricePanel;
JPanel decisionPanel;
JButton searchButton;
JButton updateButton;
JButton saveButton;
JButton deleteButton;
JButton closeButton;
JTextField booksnoField;
JTextField booksisbnField;
JTextField titleField;
JTextField authorField;
JTextField subjectField;
JTextField publisherField;
JTextField editionField;
JTextField copiesField;
JTextField priceField;
public SearchBooks(){
super();
frame = new JFrame("SEARCH BOOKS");
frame.setSize(screensize);
detailsPanel.add(booksnoPanel);
detailsPanel.add(booksisbnPanel);
mainPanel.add(mainLabel);
mainPanel.add(new JPanel());
mainPanel.add(detailsPanel);
mainPanel.add(new JPanel());
mainPanel.add(titlePanel);
mainPanel.add(new JPanel());
mainPanel.add(authorPanel);
mainPanel.add(new JPanel());
mainPanel.add(subjectPanel);
mainPanel.add(new JPanel());
mainPanel.add(publisherPanel);
mainPanel.add(new JPanel());
mainPanel.add(editionPanel);
mainPanel.add(new JPanel());
mainPanel.add(copiesPanel);
mainPanel.add(new JPanel());
mainPanel.add(pricePanel);
mainPanel.add(new JPanel());
mainPanel.add(decisionPanel);
frame.add(mainPanel);
frame.setVisible(true);
searchButton.addActionListener(this);
updateButton.addActionListener(this);
saveButton.addActionListener(this);
deleteButton.addActionListener(this);
closeButton.addActionListener(this);
}
if(e.getSource()==searchButton){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:odbc:LIBMGMT", "root", "pass");
Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery(query);
if(rs.next()){
booksnoField.setText(Integer.toString(rs.getInt(1)));
booksisbnField.setText(rs.getString(2));
titleField.setText(rs.getString(3));
authorField.setText(rs.getString(4));
subjectField.setText(rs.getString(5));
publisherField.setText(rs.getString(6));
editionField.setText(rs.getString(7));
copiesField.setText(rs.getString(8));
priceField.setText(Float.toString(rs.getFloat(9)));
}
else{
JOptionPane.showMessageDialog(new JFrame(), "Record
not found!");
}
statement.close();
conn.close();
}
catch(ClassNotFoundException e1){
}
catch(SQLException e1){
if(e.getSource()==updateButton){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
ResultSet rs = statement.executeQuery(query);
if(rs.next()){
booksnoField.setText(Integer.toString(rs.getInt(1)));
booksisbnField.setText(rs.getString(2));
titleField.setText(rs.getString(3));
authorField.setText(rs.getString(4));
subjectField.setText(rs.getString(5));
publisherField.setText(rs.getString(6));
editionField.setText(rs.getString(7));
copiesField.setText(rs.getString(8));
priceField.setText(Float.toString(rs.getFloat(9)));
}
else{
JOptionPane.showMessageDialog(new JFrame(), "Record
not found!");
}
statement.close();
conn.close();
booksnoField.setEnabled(false);
booksisbnField.setEnabled(true);
titleField.setEnabled(true);
authorField.setEnabled(true);
subjectField.setEnabled(true);
publisherField.setEnabled(true);
editionField.setEnabled(true);
copiesField.setEnabled(true);
priceField.setEnabled(true);
saveButton.setVisible(true);
}
catch(ClassNotFoundException e1){
}
catch(SQLException e1){
if(e.getSource()==saveButton){
statement.executeUpdate(query);
statement.close();
conn.close();
booksnoField.setEnabled(true);
booksisbnField.setEnabled(false);
titleField.setEnabled(false);
authorField.setEnabled(false);
subjectField.setEnabled(false);
publisherField.setEnabled(false);
editionField.setEnabled(false);
copiesField.setEnabled(false);
priceField.setEnabled(false);
saveButton.setVisible(false);
}
catch(ClassNotFoundException ce){
}
catch(SQLException se){
if(e.getSource()==deleteButton){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:odbc:LIBMGMT", "root", "pass");
Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query = "DELETE FROM BOOKSINFO WHERE BOOKNO =
"+ Integer.parseInt(booksnoField.getText())+ ";";
statement.executeUpdate(query);
statement.close();
conn.close();
booksnoField.setText("");
booksisbnField.setText("");
titleField.setText("");
authorField.setText("");
subjectField.setText("");
publisherField.setText("");
editionField.setText("");
copiesField.setText("");
priceField.setText("");
}
catch(ClassNotFoundException ce){
}
catch(SQLException se){
}
}
else{
JOptionPane.showMessageDialog(new JFrame(), "Deletion
Cancelled!");
}
if(e.getSource()==closeButton){
frame.dispose();
Coding:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
JPanel booknoPanel;
JPanel titlePanel;
College of Education Bilaspur Page 84
JPanel recieverPanel;
JPanel issueToPanel;
JPanel rollnoPanel;
JPanel issueDatePanel;
JPanel dueDatePanel;
JPanel returnDatePanel;
JPanel decisionPanel;
JFrame frame;
JTextField booknoField;
JTextField titleField;
JTextField issueToField;
JTextField rollnoField;
JTextField issueDateField;
JTextField dueDateField;
JComboBox<String>returnStatusCombo;
JButton searchButton;
JButton updateButton;
JButton saveButton;
JButton deleteButton;
JButton closeButton;
public SearchIssues(){
super();
frame = new JFrame("SEARCH ISSUES");
frame.setSize(screensize);
recieverPanel.add(rollnoPanel);
recieverPanel.add(issueToPanel);
mainPanel.add(mainLabel);
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(new JPanel());
mainPanel.add(recieverPanel);
mainPanel.add(new JPanel());
mainPanel.add(booknoPanel);
mainPanel.add(new JPanel());
mainPanel.add(titlePanel);
mainPanel.add(new JPanel());
mainPanel.add(issueDatePanel);
mainPanel.add(new JPanel());
mainPanel.add(dueDatePanel);
mainPanel.add(new JPanel());
mainPanel.add(returnDatePanel);
mainPanel.add(new JPanel());
mainPanel.add(decisionPanel);
frame.add(mainPanel);
frame.setVisible(true);
searchButton.addActionListener(this);
updateButton.addActionListener(this);
saveButton.addActionListener(this);
deleteButton.addActionListener(this);
closeButton.addActionListener(this);
}
@Override
publicvoid actionPerformed(ActionEvent se) {
// TODO Auto-generated method stub
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:LIBMGMT",
"root", "pass");
Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
if(rollnoField.getText().equals("")
&&booknoField.getText().equals("")){
JOptionPane.showMessageDialog(new JFrame(), "Input Roll No/
Book No to search a record!");
}
if(rollnoField.getText().equals("")){
query = "SELECT * FROM ISSUESINFO WHERE BOOKNO = "+
Integer.parseInt(booknoField.getText())+ ";";
}
if(booknoField.getText().equals("")){
query = "SELECT * FROM ISSUESINFO WHERE ISSUEDROLLNO = "+
Integer.parseInt(rollnoField.getText())+ ";";
}
ResultSet rs = statement.executeQuery(query);
if(rs.next()){
booknoField.setText(Integer.toString(rs.getInt(1)));
titleField.setText(rs.getString(2));
rollnoField.setText(Integer.toString(rs.getInt(3)));
issueToField.setText(rs.getString(4));
issueDateField.setText(rs.getString(5));
dueDateField.setText(rs.getString(6));
returnStatusCombo.setSelectedItem(rs.getString(7));
}
else{
JOptionPane.showMessageDialog(new JFrame(), "Record not
found!");
}
statement.close();
conn.close();
}
catch(ClassNotFoundException e){
System.out.println(e);
}
catch(SQLException ce)
{
System.out.println(ce);
}
if(se.getSource()==updateButton){
oldBookno= Integer.parseInt(booknoField.getText());
rollnoField.setEnabled(false);
issueToField.setEditable(false);
booknoField.setEnabled(true);
titleField.setEnabled(true);
issueDateField.setEnabled(true);
dueDateField.setEnabled(true);
returnStatusCombo.setEnabled(true);
saveButton.setVisible(true);
if(se.getSource()==saveButton){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Connection conn = null;
Statement statement = null;
try {
conn = DriverManager.getConnection("jdbc:odbc:LIBMGMT",
"root", "pass");
statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(returnStatusCombo.getSelectedItem().equals("Returned")){
query = "DELETE FROM ISSUESINFO WHERE BOOKNO = "+ oldBookno+
";";
JOptionPane.showMessageDialog(new JFrame(), "Deleting
record.");
}
else{
query = "UPDATE ISSUESINFO SET BOOKNO = "+
Integer.parseInt(booknoField.getText())+ ", TITLE = '"+
titleField.getText()+ "', ISSUEDROLLNO = "+
Integer.parseInt(rollnoField.getText())+ ", ISSUEDSTNAME = '"+
issueToField.getText()+ "', ISSUEDATE = '"+
issueDateField.getText()+ "', DUEDATE = '"+ dueDateField.getText()+
try {
statement.executeUpdate(query);
statement.close();
conn.close();
JOptionPane.showMessageDialog(new JFrame(), "Database
Updated!");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
saveButton.setVisible(false);
rollnoField.setEnabled(true);
issueToField.setEditable(false);
booknoField.setEnabled(true);
titleField.setEnabled(false);
issueDateField.setEnabled(false);
dueDateField.setEnabled(false);
returnStatusCombo.setEnabled(false);
}
if(se.getSource()==deleteButton){
int confirm = JOptionPane.showConfirmDialog(new JFrame(), "Are you sure about deleting
this record?");
if(confirm==JOptionPane.YES_OPTION){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:odbc:LIBMGMT", "root", "pass");
Statement statement =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query = "DELETE FROM ISSUESINFO WHERE BOOKNO =
"+ Integer.parseInt(booknoField.getText())+ ";";
statement.executeUpdate(query);
statement.close();
conn.close();
rollnoField.setText("");
booknoField.setText("");
titleField.setText("");
issueToField.setText("");
issueDateField.setText("");
}
catch(ClassNotFoundException ce){
}
catch(SQLException qe){
}
}
else{
JOptionPane.showMessageDialog(new JFrame(), "Deletion
Cancelled!");
}
}
if(se.getSource()==closeButton){
frame.dispose();
}
9. TESTING
Functionality Testing
Apart from SearchIssues.java module, every module is working as per expected output.
SearchIssues.java does not allow changing in the values of BOOKNO or TITLE since they are
foreign keys and cannot be altered.
Usability Testing
The project is working well and can be used in the real system. It does not need network interface
so its installation is complete offline and standalone.
Interface Testing
Interface is completely functional and designed for large resolution screens. Preffered screen
resolution is 1366x768; any change in screensize/window size may hide/cut/overlap the swing
components from visible portion of the screen.
College of Education Bilaspur Page 91
Compatibility Testing
The project is compatible with all types of operating systems if proper drivers and compatible java
runtime environment is installed. Incase MySQL ODBC Driver is missing/incompatible; the
software may run but would not work along the database which means no
deletion/updation/addition/evaluation of data from the tables of the database.
Performance Testing
Performance of the software depends upon the hardware functions and amount of memory available
for the software to work. In case of low RAM, shortage of disk space, underclocked processor or
database related problems, the program may work slow or may not work at all and can even fail to
execute.
Security Testing
System is completely secured and integrated. Any user with invalid credidentials will not be able to
connect to the database. The project itself cannot interfere with the system security or security of
other softwares installed in the system.
With the changing time and rapid growth in technological fields, future development of this project
might need to eliminate existing errors/bugs or improve the interface and functioning of the
software.
Current build of the software is not overall complete in itself. It needs added background
images, better searching techniques and more reliable error/exception handling and
acknowledgement of the same to the user.
With the increase in number of students and the library resources, database will also have to be
extended to meet the huge requirement ahead of it. As every year, the university/college using this
system will gather more students and books, the current data types for the database will be felt
limited and therefore it may need change in the whole database.
There can also be added complexity to the database as more information about the students
or books maybe required being stored.
Distortion in user interface when the window is resized into smaller size. Usually this results
in overlapping of components or reduced visible portion of the swing components.
In case there is type mismatch while writing values to the tables in the database, the
errors/exceptions are displayed over the console which is hidden from the user on the time
of execution.
Dates/Edition of books is taken as String input.
In case book details are entered incorrect in the issues table, that record cannot be modified
and needs to be deleted and create/added as a new record.
From a proper analysis of positive points and constraints onthe component, it can be safely
concluded that the software isa highly efficient GUI based component. This application is
working properly and meeting to all user requirements. The software does not need very high
system configuration and does not hang the system that is using it.