Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 34

BANKER DATABASE SYSTEM

A PROJECT REPORT

In partial fulfillment for the award of the degree

Of

BACHELOR OF TECHNOLOGY
IN

COMPUTER SCIENCE

HCL INFOSYSTEMS LIMITED,

www.hclinfosystems.in

Submitted by Submitted To:

Arpit kumar
Acknowledgement

I am feeling extremely satisfied presenting this project report entitled “Banker


Database System”. I take this opportunity to express my acknowledgement and
deep sense of gratitude to the individuals for rendering valuable assistance and
gratitude to me. Their input have played a vital role in success of this project &
formal piece of acknowledgement may not be sufficient to express the feeling of
gratitude towards people who have helped me in successfully completion of my
training.
I would like to wish my sincere thanks to my company guide Mr. Vinay Prakash
Dwivedi (senior project manager at HCL Infosystems, noida), who is my
external guide.
I take this opportunity to thank all respondents who spared their precious time to
provide me with valuable input for project without which it would have not been
possible.
I firmly believe that there is always a scope of improvement. I welcome any
suggestions for further enriching the quality of this report.

ARPIT KUMAR
Preface

Banker database system is an application which uses a database to perform bank


transactions, enables creating new accounts along with their initial balance,
withdrawing or depositing to an account and also displaying the account
information. This project can help the various banks to perform all the transactions
provided by the application.
Engineering is not only a theoretical study but it is a implementation of all we
study for creating something new and making things more easy and useful through
practical study.

For me, it is very knowledgeable and interesting as well. I have chosen Java SE as
front end because it provides very good graphical user interface and Microsoft
Office Access as back end tool.
www.hclinfosystems.in

HCL Infosystems Ltd is India’s premier hardware, services and ICT systems
Integration Company offering a wide spectrum of ICT products that includes
Computing, Storage, Networking, Security, Telecom, Imaging and Retail. HCL is
a one-stop-shop for all the ICT requirements of an organization. India's leading
System Integration and Infrastructure Management Services Organization, HCL
has specialized expertise across verticals including Telecom, BFSI, eGovernance
& Power. HCL has India's largest distribution and retail network, taking to market
a range of Digital Lifestyle products in partnership with leading global ICT brands,
including Apple, Cisco, Ericsson, Kingston, Kodak, Konica Minolta, Microsoft,
Nokia, Toshiba, and many more.

HCL Infosystems (HCLI) draws its strength from 30 years of experience in


handling the ever changing IT scenario , strong customer relationships, ability to
provide the cutting edge technology at best-value-for-money and on top of it, an
excellent service & support infrastructure. Today, HCL is country's premier
information enabling company. It offers one-stop-shop convenience to its diverse
customers having an equally diverse set of requirements.

Technology Leadership:

HCL Infosystems is known to be the harbinger of technology in the country. Right


from its inception it has attempted to pioneer the technology introductions in the
country either through its R&D or through partnerships with the world technology
leaders.

Using its own R&D it has:

 Created its own UNIX & RDBMS capability (in 80s).


 Developed firewalls for enterprise & personal system security.
 Launched its range of enterprise storage products.
 Launched its range of networking products.

HCL strive to understand the technology from the view of supporting it post
installation as well. This is one of the key ingredients that go into its strategic
advantage.
Contents

1. INTRODUCTION
2. METHODOLOGY
3. ADVANTAGES & GOALS OF CURRENT SYSTEM
4. TOOLS & TECHNOLOGY
5. DESCRIPTION OF FRONT END & BACK END
6. DATA FLOW DIAGRAM
7. SNAP SHOTS OF FRAMES
8. DATABASE STRUCTURE FOR BDS
9. SOURCE CODE
10. LIMITATIONS
11. FUTURE ASPECTS
12. CONCLUSION
INTRODUCTION

Banker database system:


Banker database system is an application which uses a database to perform bank
transactions. We used Java as front end and Microsoft Office Access as back end.
This project has a main class that brings up a class and a file menu that display
about banker. Main class inherits and calls all other classes through the pressing of
corresponding buttons and adds records to the program. The main class enables
withdrawing or depositing to an account and displays the account information.
Here, we also have an account master class through which new accounts can be
added to the database along with their initial balance.

The objective of the project is to develop a GUI based automated system, which
will cover all the information related to the Account holder. For example: creating
new account, deposit or withdrawal, balance information.

Features:
Banker database system enables creating new accounts along with their
initial balance, withdrawing or depositing to an account and also displaying the
account information. The entire database is stored in Microsoft Office Access
which is familiar to everyone and anyone can access it easily. So, the banker
database system is user friendly.
METHODOLOGY
The methodology used in banker database system includes four steps:

1. Planning and aims


2. Implementation
3. Evaluation
4. Feedback and improvement procedures

ADVANTAGES & GOALS OF CURRENT SYTEM


Banker database system is an application which uses a database to perform bank
transactions.

Advantages of banker database system:

1. Application takes less time & gives better results.


2. It reduces the tedious jobs, like (Long procedures, Up to Date Information).
3. It will improve the banker database system, since all the information is
available whenever required.
4. It provides quick processing thus helps in transaction.
5. It provides accurate output.
6. It quickly responds to queries.
7. The amount of paper work is reduced.

Goals of banker database system:


1. Immediate retrieval of information: The main objective of the system is to
provide for quick and efficient retrieval of information. Any type of
information would be available to the user whenever he requires.

2. Immediate storage of information: In the proposed system, it will be easy


to store information at any given time at the correct places. The location of
storage would be easily available and user will face no difficulty.
3. Fast computation of information: The computation of information will be
quite fast in the proposed system. Not only mathematical calculations, but
also logical comparisons will be quick in the new system.

4. Planned approach toward working: The working in the service center


information system will be well planned and organized. The data will be
stored properly in the data store, which will help in retrieval of information
as well as in its storage.

5. Accuracy: The level of accuracy in the proposed system would be higher.


All operations and computations would be done correctly and this will
ensure that whatever information is coming from the center is accurate.

6. Reliability: The reliability of the proposed system would be high due to the
above stated reasons.

TOOLS & TECHNOLOGY


Operating system: Windows 2k family
Front End: Java SE
Back End: Microsoft Office Access
RAM: 128MB
Hard disk: 5GB
DESCRIPTION OF FRONT END & BACK END

We have used Java SE as front end tool & Microsoft Office Access as back end tool
described as follows:
Java SE:
Java Platform, Standard Edition or Java SE is a widely used platform
for programming in the Java language. It is the Java Platform used to deploy
portable applications for general use. In practical terms, Java SE consists of a
virtual machine, which must be used to run Java programs, together with a
set of libraries (or "packages") needed to allow the use of file systems,
networks, graphical interfaces, and so on, from within those programs.

Advantages of Java SE:


• It is simple, object oriented and familiar.
• It is robust and secure.
• It is architecture-neutral and portable.
• It has high performance.
• It is interpreted, multithreaded and dynamic.
• It is available with documentation in many languages.

Microsoft Office Access:


Microsoft Office Access is a relational database management system
from Microsoft that combines the relational Microsoft Jet Database Engine with a
graphical user interface and software-development tools. It is a member of the
Microsoft Office suite of applications, included in the Professional and higher
editions or sold separately.

Access stores data in its own format based on the Access Jet
Database Engine. It can also import or link directly to data stored in other
applications and databases.
Software developers and data architects can use Microsoft Access to develop
application software, and "power users" can use it to build simple applications.
Like other Office applications, Access is supported by Visual Basic for
Applications, an object-oriented programming language that can reference a
variety of objects including DAO (Data Access Objects), ActiveX Data Objects,
and many other ActiveX components. Visual objects used in forms and reports
expose their methods and properties in the VBA programming environment, and
VBA code modules may declare and call Windows operating-system functions.

Advantages of Microsoft Office Access:


• Get better results faster with the Office Fluent user interface.
• Get started quickly using prebuilt solutions.
• Create multiple reports with different views of the same information.
• Create tables quickly without worrying about database complexity.
• Enjoy new field types for even richer scenarios.
• Collect and update your information directly from the source.
• Share your information with Microsoft Windows SharePoint Services.
• Track Windows SharePoint Services lists with the rich client capabilities of
Office Access 2007.
• Access and use information from multiple sources.
DATA FLOW DIAGRAM

INFORMATION
SUBMIT

DATABASE

INFORMATION
SHOW
SNAP SHOTS OF FRAMES

1. About Banker

2. Main Menu
3. Accounts Master

4. Adding information to database


5. Deposits/Withdrawals

6. Display Balance
DATABASE STRUCTURE FOR BDS
1. Master

2. Transaction
SOURCE CODE
/**Banker.java*/
package bank;
/**
* <p>Title: Banker</p>
* <p>Description: Application which uses a database to perform
bank transactions</p>
* <p>College: Baldevram Mirdha Institute of Technology,
Jaipur</p>
* @Ritesh Kumar, Priyanka
* @2008-2012
*/
import java.awt.*;
import java.sql.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;

import bank.MainMenu;

public class Banker extends JFrame{


private JMenu fileMenu; // Declare Menu fileMenu
private JTextArea outputTextArea;

public Banker() {
super ("Banker");

try {

/////// File Menu ///////


fileMenu = new JMenu("File");
fileMenu.setMnemonic('F');

JMenuItem aboutItem = new JMenuItem("About Banker...");


aboutItem.setMnemonic('A');

String output;
outputTextArea = new JTextArea(); // Instantiate
outputTextArea

// Declare string output for aboutbox and add it to


outputTextArea
output = new String("Programmer: \n\tRitesh Kumar &\n\
tPriyanka\n\tBatch: 2008-2012\n\tB.M.I.T. Jaipur");
outputTextArea.setText(output);
outputTextArea.setEditable(false);
outputTextArea.setBackground(Color.lightGray);
outputTextArea.setFont(new Font("Ariel",Font.PLAIN,12));
////////// Show About Box on aboutItem pressed ///////////
aboutItem.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event){

JOptionPane.showMessageDialog(Banker.this,outputTextArea,
"About Banker",JOptionPane.PLAIN_MESSAGE);
}
}
);
////////////////////////////////

fileMenu.add(aboutItem); //// Add aboutItem to fileMenu

JMenuItem exitItem = new JMenuItem("Exit");


exitItem.setMnemonic('X');

///////// Exit on exitItem Pressed ///////////


exitItem.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
System.exit(0);
}
}
);

fileMenu.add(exitItem); /// Add exitItem to fileMenu

JMenuBar bar = new JMenuBar();


setJMenuBar(bar);
bar.add(fileMenu);

setSize(400,400);
setVisible(true);
setLocation(500,200);

MainMenu bank1 = new MainMenu(); // Call MainMenu


bank1.setResizable(false); // set MainMenu resizable to
false
}
catch(Exception e) {
e.printStackTrace();
}
}

/////////// Main method ///////////////


public static void main(String args[])
{
///// Set lookandfeel to windowslookandfeel //////
try {

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName(
));
}
catch(Exception e) {
System.out.println("Error is " + e.getMessage());
}
Banker application = new Banker();
application.setResizable(false);

application.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
}

/**AccMaster.java*/
package bank;

import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import javax.swing.*;

public class AccMaster extends JFrame{


/////// Declaration of Components ///////
private JTextField accNoTxt, opnBalTxt;
private JPanel panel1;
private JLabel accNoLbl, opnBalLbl,accMasterLbl;
private JFrame frame;
private JButton btn;
////////////////////////////////////////

public AccMaster() { // Set up GUI

super ("Accounts Master"); // Set Frame Caption

// Get content pane and set its layout


Container container = getContentPane();
container.setLayout(new FlowLayout());

// Instantiate panel and set its layout


panel1 = new JPanel();
panel1.setLayout(new GridLayout(6,1,5,5));

//// Add Components to panel1 ////


accMasterLbl = new JLabel("Accounts Master");
panel1.add(accMasterLbl);

accNoLbl = new JLabel("Enter Account No.");


panel1.add(accNoLbl);

accNoTxt = new JTextField(15);


panel1.add(accNoTxt);

opnBalLbl = new JLabel("Enter Opening Balance.");


panel1.add(opnBalLbl);

opnBalTxt = new JTextField(15);


panel1.add(opnBalTxt);

btn = new JButton("Ok");


panel1.add(btn);

/////////////////////////////////

//////// Add handlers to opnBalTxt ////////


EventHandler handler = new EventHandler();
opnBalTxt.addActionListener(handler);
///////////////////////////////////////////
btn.addActionListener(handler);
// Add panel1 to container
container.add(panel1,BorderLayout.CENTER);

setSize(250,200);
setVisible(true);
setLocation(575,320);
}

// Inner class for EventHandler


private class EventHandler implements ActionListener{

// Handles textbox event


public void actionPerformed(ActionEvent event)
{
// If Enter is pressed when opnBalTxt box has focus
if (event.getSource() == btn &&
opnBalTxt.getText() != null && opnBalTxt.getText() != " ")
{

/// Confirm addition of information to database


int choice = JOptionPane.showConfirmDialog(frame,
"Add this information to the database?",
"Banker",JOptionPane.YES_NO_OPTION);

// If YES
if(choice == JOptionPane.YES_OPTION)
{
try {

// load database driver class


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

// connect to database
Connection connection =
DriverManager.getConnection("jdbc:odbc:Bank");

// create Statement to query database


Statement statement = connection.createStatement();

// Add new acount to Master table


Statement stmt = connection.createStatement();
stmt.executeUpdate(
"INSERT INTO Master " +
"VALUES ('" + accNoTxt.getText() + "', " +
Long.parseLong(opnBalTxt.getText())+ ")");

JOptionPane.showMessageDialog(null,"Data Entered into


Database Successfully");
opnBalTxt.setText(" ");
accNoTxt.setText(" ");

statement.close(); // Close statement


connection.close(); // Close connection

setVisible(false); // Hide frame

} // end try

// detect problems interacting with the database


catch ( SQLException sqlException ) {
JOptionPane.showMessageDialog( null,
sqlException.getMessage(), "Database Error",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}

catch ( ClassNotFoundException classNotFound ) {


JOptionPane.showMessageDialog( null,
classNotFound.getMessage(), "Driver Not Found",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}
catch(Exception e)
{
}

}
// If NO
else{
opnBalTxt.setText(" ");
accNoTxt.setText(" ");
setVisible(false); // Hide Frame

}
}
}

} // End EventHandler class

} // End class AccMaster

/**depositDraw.java*/

package bank;

import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import javax.swing.*;

public class depositDraw extends JFrame{


/////// Declaration of Components and global variables ///////
private JLabel depositsLbl,
accNoLbl,transAmountLbl,transTypeLbl;
private JTextField accNoTxt,transAmountTxt,transTypeTxt;
private JPanel panel1;
private JFrame frame;
private JButton btn;
private int transactionType; // Transaction type
//////////////////////////////////////////////////////////////

public depositDraw(int transactionType1) {

super("Deposits / Withdrawals");
// Assign trasactionType1 to global variable transactionType
transactionType = transactionType1;

// Get content pane and set its layout


Container container = getContentPane();
container.setLayout(new FlowLayout());

// Instantiate panel and set its layout


panel1 = new JPanel();
panel1.setLayout(new GridLayout(8,1,5,5));

//// Add Components to panel1 ////


depositsLbl = new JLabel("Deposits / Withdrawals");
panel1.add(depositsLbl);

accNoLbl = new JLabel("Enter Account No.");


panel1.add(accNoLbl);

accNoTxt = new JTextField(15);


panel1.add(accNoTxt);

transAmountLbl = new JLabel("Transaction Amount");


panel1.add(transAmountLbl);

transAmountTxt = new JTextField(15);


panel1.add(transAmountTxt);

transTypeLbl = new JLabel("Transaction Type");


panel1.add(transTypeLbl);
/////////////////////////////////

// Set transTypeTxt textbox to transactionType1 and


// setEditable property to false
transTypeTxt = new JTextField(15);
transTypeTxt.setText(Integer.toString(transactionType1));
transTypeTxt.setEditable(false);
panel1.add(transTypeTxt);
btn = new JButton("Ok");
panel1.add(btn);

// Add panel1 to container


container.add(panel1,BorderLayout.CENTER);

/////// Add handlers to components ///////


EventHandler handler = new EventHandler();
accNoTxt.addActionListener(handler);
transAmountTxt.addActionListener(handler);
transTypeTxt.addActionListener(handler);
btn.addActionListener(handler);
//////////////////////////////////////////
setSize(250,250);
setVisible(true);
setLocation(575,320);

// Inner class for EventHandler


private class EventHandler implements ActionListener{
// Handles event
public void actionPerformed(ActionEvent event){
// If Enter is pressed when transAmountTxt box has focus
if (event.getSource() == btn)
{

if (transAmountTxt.getText() != null &&


transAmountTxt.getText() != " "){

/// Confirm addition of information to database


int choice = JOptionPane.showConfirmDialog(frame,"Are you
sure?",
"Banker",JOptionPane.YES_NO_OPTION);
if(choice == JOptionPane.YES_OPTION)
{ double transaction_amount;

transaction_amount =
Double.parseDouble(transAmountTxt.getText());
double current_balance;
///////////////////////////////////////////////////////////
////////////////

try {

// load database driver class


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

// connect to database
Connection connection =
DriverManager.getConnection("jdbc:odbc:Bank" );

Statement stmt = connection.createStatement();

ResultSet resultSet =
stmt.executeQuery(
"SELECT Current_Balance FROM Master WHERE Account_No = '" +
accNoTxt.getText() + "'");
// process query results

StringBuffer results = new StringBuffer();


ResultSetMetaData metaData = resultSet.getMetaData();
int numberOfColumns = metaData.getColumnCount();

while ( resultSet.next() ) {

for ( int i = 1; i <= numberOfColumns; i++ ) {


results.append( resultSet.getObject( i ));

}
}
stmt.close();
connection.close();

String current_balance1 = results.toString();


current_balance = Double.parseDouble(current_balance1);

if (transactionType == 2)// Withdrawal


{ if (transaction_amount <= 15000)// If transaction_amount
is <= $15000
{

// U user tries to draw more than he has


if (current_balance > transaction_amount){
try {

// load database driver class


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

// connect to database
Connection connection1 =
DriverManager.getConnection("jdbc:odbc:Bank" );

Statement stmt1 = connection1.createStatement();

//Statement stmt1 = connection.createStatement();


stmt1.executeUpdate(
"INSERT INTO Transaction " +
"VALUES ('" + accNoTxt.getText() + "', " +
String.valueOf(transAmountTxt.getText())+
"," + transactionType + ")");

double answer = current_balance - transaction_amount;


String updateString = "UPDATE Master " +
"SET Current_Balance = "+ answer + " " +
"WHERE Account_No LIKE '" + accNoTxt.getText() + "'";

stmt1.executeUpdate(updateString);
stmt1.close();
connection1.close();

JOptionPane.showMessageDialog(null,"Data Entered
into Database Successfully");
accNoTxt.setText(" ");
transAmountTxt.setText(" ");
setVisible(false);
}
catch ( SQLException sqlException ) {
JOptionPane.showMessageDialog( null,
sqlException.getMessage(), "Database Error",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}

catch ( ClassNotFoundException classNotFound ) {


JOptionPane.showMessageDialog( null,
classNotFound.getMessage(), "Driver Not Found",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}
}
else{
JOptionPane.showMessageDialog(null,"You Cannot
Draw more than you have.");
accNoTxt.setText(" ");
transAmountTxt.setText(" ");
setVisible(false);
}
}
else{
JOptionPane.showMessageDialog(null,"You cannot
withdraw more than $15,000.");
accNoTxt.setText(" ");
transAmountTxt.setText(" ");
setVisible(false);
}
}
else
if (transactionType == 1){ // Deposit
try {

// load database driver class


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

// connect to database
Connection connection2 =
DriverManager.getConnection("jdbc:odbc:Bank" );

Statement stmt2 = connection2.createStatement();

stmt2.executeUpdate(
"INSERT INTO Transaction " +
"VALUES ('" + accNoTxt.getText() + "', " +
String.valueOf(transAmountTxt.getText())+ ","+
transactionType + ")");

//String current_balance1 = results.toString();


// long current_balance =
String.valueOf(current_balance1);

double answer = current_balance + transaction_amount;


String updateString = "UPDATE Master " +
"SET Current_Balance = "+ answer + " " +
"WHERE Account_No LIKE '" + accNoTxt.getText() + "'";

stmt2.executeUpdate(updateString);

JOptionPane.showMessageDialog(null,"Data Entered into


Database Successfully");
accNoTxt.setText(" ");
transAmountTxt.setText(" ");

stmt2.close();
connection2.close();
setVisible(false);
}

catch ( SQLException sqlException ) {


JOptionPane.showMessageDialog( null,
sqlException.getMessage(), "Database Error",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}

catch ( ClassNotFoundException classNotFound ) {


JOptionPane.showMessageDialog( null,
classNotFound.getMessage(), "Driver Not Found",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}
}
} // end try

// detect problems interacting with the database


catch ( SQLException sqlException ) {
JOptionPane.showMessageDialog( null,
sqlException.getMessage(), "Database Error",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}

catch ( ClassNotFoundException classNotFound ) {


JOptionPane.showMessageDialog( null,
classNotFound.getMessage(), "Driver Not Found",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}

}
else{
accNoTxt.setText(" ");
transAmountTxt.setText(" ");
setVisible(false);

}
}
}

} }
}

/**DispBal.java*/
package bank;

import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import javax.swing.*;

public class DispBal extends JFrame{


/////// Declaration of Components ///////
private JTextField accNoTxt, balanceTxt;
private JPanel panel1;
private JLabel accNoLbl, balanceLbl,dispBalLbl;
private JButton btn;
////////////////////////////////////////

public DispBal() {// Set up GUI


super ("Display Balance");// Set Frame Caption

// Get content pane and set its layout


Container container = getContentPane();
container.setLayout(new FlowLayout());

// Instantiate panel and set its layout


panel1 = new JPanel();
panel1.setLayout(new GridLayout(6,1,5,5));

//// Add Components to panel1 ////


dispBalLbl = new JLabel("Display Balance");
panel1.add(dispBalLbl);

accNoLbl = new JLabel("Enter Account No.");


panel1.add(accNoLbl);

accNoTxt = new JTextField(15);


panel1.add(accNoTxt);

balanceLbl = new JLabel("Display Current Balance.");


panel1.add(balanceLbl);

balanceTxt = new JTextField(15);


panel1.add(balanceTxt);

btn = new JButton("Ok");


/////////////////////////////////

//////// Add handlers to opnBalTxt ////////


EventHandler handler = new EventHandler();
accNoTxt.addActionListener(handler);
balanceTxt.addActionListener(handler);
btn.addActionListener(handler);
panel1.add(btn);
///////////////////////////////////////////

// Add panel1 to container


container.add(panel1,BorderLayout.CENTER);

setSize(220,200);
setVisible(true);
setLocation(590,320);
}
private class EventHandler implements ActionListener{
public void actionPerformed(ActionEvent event)
{
if (event.getSource() == btn)
////////////////////////////////////////////////////////
///////////////////
if (accNoTxt.getText() != null && accNoTxt.getText() !
= " "){
try {

// load database driver class


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

// connect to database
Connection connection =
DriverManager.getConnection("jdbc:odbc:Bank");

// create Statement to query database


Statement statement = connection.createStatement();

// query database
ResultSet resultSet =
statement.executeQuery(
"SELECT Current_Balance FROM Master WHERE Account_No
= '" + accNoTxt.getText() + "'");

// process query results

StringBuffer results = new StringBuffer();


ResultSetMetaData metaData = resultSet.getMetaData();
int numberOfColumns = metaData.getColumnCount();

while ( resultSet.next() ) {

for ( int i = 1; i <= numberOfColumns; i++ ) {


results.append( resultSet.getObject( i ));

}
}
statement.close();
connection.close();

balanceTxt.setText(results.toString());
} // end try

// detect problems interacting with the database


catch ( SQLException sqlException ) {
JOptionPane.showMessageDialog( null,
sqlException.getMessage(), "Database Error",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}
catch ( ClassNotFoundException classNotFound ) {
JOptionPane.showMessageDialog( null,
classNotFound.getMessage(), "Driver Not Found",
JOptionPane.ERROR_MESSAGE );

System.exit( 1 );
}
}}}}

/**MainMenu.java*/
package bank;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import bank.*;

public class MainMenu extends JFrame{


/////// Declaration of Components ///////
private JButton accMasterBtn, depositsBtn,
withDrawalsBtn,dispBalBtn;
private JLabel mainLbl;
private JPanel panel1;
////////////////////////////////////////

public MainMenu() {
super("Main Menu");

// Get contentPane and set its layout


Container container = getContentPane();
container.setLayout(new FlowLayout());

panel1 = new JPanel();

mainLbl = new JLabel(" Main Menu");


panel1.add(mainLbl);// add mainLbl to panel1

accMasterBtn = new JButton("Accounts Master");


panel1.add(accMasterBtn);// add accMasterBtn to panel1

depositsBtn = new JButton("Deposits");


panel1.add(depositsBtn);// add depositsBtn to panel1

withDrawalsBtn = new JButton("Withdrawals");


panel1.add(withDrawalsBtn);// add withDrawalsBtn to panel1

dispBalBtn = new JButton("Display Balance");


panel1.add(dispBalBtn); // add disoBalBtn to panel1

panel1.setLayout(new GridLayout(5,1,10,10));
container.add(panel1,BorderLayout.CENTER); // Add panel1 to
container

////// AddActionListner to components ///////


ButtonHandler handler = new ButtonHandler();
accMasterBtn.addActionListener(handler);
depositsBtn.addActionListener(handler);
withDrawalsBtn.addActionListener(handler);
dispBalBtn.addActionListener(handler);

setSize(300,230);
setVisible(true);
setLocation(550,280);
}

private class ButtonHandler implements ActionListener{


public void actionPerformed(ActionEvent event)
{
if(event.getSource() == accMasterBtn)
{ AccMaster acc = new AccMaster(); /// Call AccMaster Frame
acc.setResizable(false);
}
else if(event.getSource() == depositsBtn)
{ depositDraw dep = new depositDraw(1); /// Call AccMaster
Frame
dep.setResizable(false);

}
else if(event.getSource() == withDrawalsBtn)
{ depositDraw dep = new depositDraw(2); /// Call AccMaster
Frame
dep.setResizable(false);
}
else if(event.getSource() == dispBalBtn)
{ DispBal bal = new DispBal(); /// Call AccMaster Frame
bal.setResizable(false);
}
}}}
LIMITATIONS

Although I have tried to do the best & tried to do all the things that are possible in
the system, but still the system contains some of the limitations because of time
constraints.
I am still working on this application and my next goal is to remove these
limitations and develop a more efficient and elegant system.

FUTURE ASPECTS
Banker database system doesn’t end here; it is just a starting, we will look forward
for its future development through more and more challenging projects and also
foraying into related areas in with innovative ideas.

CONCLUSION
Banker database system provides a graphical user interface to the end user so that
he/she can easily interact with the system and perform all the transactions provided
by the system with comfort and it’s our main goal to provide ease to the end user,
customer’s comfort is the main priority of this system.

You might also like