BANK MANAGEMENT SYSTEMS
Integrating python and mysql
PROJECT BY : AVIRUP CHAKRABORTY
TABLE OF CONTENTS
Certificate 3
Acknowledgement 4
Introduction 5
Source code 7-12
Sample output 13-22
Limitations 23
Basic Enhancement 24
Bibliography
25
2|Page
CERTIFICATE
This is hereby to certify that the original and
genuine investigation work has been carried out to
investigate about the subject matter and the related
data collection and investigation has been
completed solely, sincerely and satisfactorily by
Avirup Chakraborty of Class XII Sc-A regarding
his project titled
“Bank Management Systems”
Internal invigilator external invigilator
3|Page
ACKNOWLEDGEMENT
It would be my utmost pleasure to express my
sincere thanks to my computer teacher Mr.
Devashish Chakraborty in providing a helping hand
in this project. His valuable guidance, support and
supervision all through this project titled“Bank
Management Systems”, are responsible for
attaining its present form.
Avirup Chakraborty
Class XII Sc-A
4|Page
Understanding Bank Management Systems
INTRODUCTION
Bank Management Systems (BMS) are crucial
software applications that enable efficient
handling of financial operations within banking
institutions. These systems facilitate various
banking functionalities, including account
creation, transactions, balance inquiry, and
account closure.
5|Page
Core Components of a BMS
Database Management: BMS utilizes
databases to store and manage account-
related information, transaction records, and
user data. Common database systems like
MySQL, PostgreSQL, or Oracle are
employed for this purpose.
Account Operations:
Account Creation: BMS allows for the
creation of new accounts by collecting
customer details and assigning unique
account numbers.
Transaction Handling: It supports
depositing and withdrawing funds from
accounts while ensuring accurate updates to
account balances.
Balance Inquiry: Provides account holders
with their current account balance.
6|Page
User Interface: BMS often includes user-
friendly interfaces to interact with the
system, making it accessible for bank
employees to manage accounts efficiently.
Security Measures: These systems
implement security protocols to safeguard
sensitive financial data and prevent
unauthorized access.
Challenges and Solutions
Data Integrity and Security: BMS must
ensure data integrity, accuracy, and security.
This involves implementing encryption
techniques, access controls, and regular
backups to prevent data loss or breach.
Transaction Handling: Ensuring atomicity,
consistency, isolation, and durability (ACID
properties) in transactions to maintain
reliability and accuracy during various
operations.
7|Page
Error Handling: Robust error handling
mechanisms are essential to manage
unexpected situations, preventing system
crashes and data corruption.
8|Page
CONCLUSION
Bank Management Systems play a pivotal role in
modern banking, offering a comprehensive solution
to manage accounts and transactions efficiently
while prioritizing data security, reliability, and
customer satisfaction.
9|Page
SOURCE CODE
import mysql.connector
import random
try:
# Database Connection
mycon =
mysql.connector.connect(host='local
host', user='root', passwd='admin')
cursor = mycon.cursor()
cursor.execute("CREATE
DATABASE IF NOT EXISTS
Bank")
cursor.execute("USE Bank")
10 | P a g e
cursor.execute("CREATE TABLE
IF NOT EXISTS data (AccNo INT
PRIMARY KEY
AUTO_INCREMENT, Name
VARCHAR(50), Type CHAR(1),
Balance INT)")
except mysql.connector.Error as err:
print(f"Error: {err}")
# Function to Create Account
def createAccount():
try:
accNo =
random.randint(10000000,
99999999)
11 | P a g e
name = input("\nEnter the
Account Holder's name: ")
acctype = input("Enter the type
of Account [C/S]: ").upper()
balance = int(input("Enter The
Initial amount: "))
insert_query = f"INSERT INTO
data (AccNo, Name, Type, Balance)
VALUES ('{accNo}', '{name}',
'{acctype}', '{balance}')"
cursor.execute(insert_query)
mycon.commit()
print("\nAccount Created.
Account Number:", accNo)
12 | P a g e
except mysql.connector.Error as
err:
print(f"Error: {err}")
# Function to Deposit Money
def depositMoney():
try:
accNo = int(input("\nEnter the
Account Number: "))
amount = int(input("Enter the
amount to deposit: "))
update_query = f"UPDATE data
SET Balance = Balance + {amount}
WHERE AccNo = {accNo}"
cursor.execute(update_query)
13 | P a g e
mycon.commit()
print("\nAmount Deposited
Successfully!")
except mysql.connector.Error as err:
print(f"Error: {err}")
# Function to Withdraw Money
def withdrawMoney():
try:
accNo = int(input("\nEnter the
Account Number: "))
amount = int(input("Enter the
amount to withdraw: "))
update_query = f"UPDATE
data SET Balance = Balance -
14 | P a g e
{amount} WHERE AccNo =
{accNo}"
cursor.execute(update_query)
mycon.commit()
print("\nAmount Withdrawn
Successfully!")
except mysql.connector.Error as
err:
print(f"Error: {err}")
# Function to Display Balance
def displayBalance():
try:
accNo = int(input("\nEnter the
Account Number: "))
15 | P a g e
select_query = f"SELECT
Balance FROM data WHERE
AccNo = {accNo}"
cursor.execute(select_query)
balance = cursor.fetchone()
if balance:
print("\nYour Current
Account Balance is:", balance[0])
else:
print("\nAccount Not
Found!")
except mysql.connector.Error as
err:
print(f"Error: {err}")
# Function to Close Account
16 | P a g e
def closeAccount():
try:
accNo = int(input("\nEnter the
Account Number: "))
delete_query = f"DELETE
FROM data WHERE AccNo =
{accNo}"
cursor.execute(delete_query)
mycon.commit()
print("\nAccount Closed
Successfully!")
except mysql.connector.Error as
err:
print(f"Error: {err}")
# Main Menu Loop (Extended)
17 | P a g e
while True:
try:
print("\n\n\t---MAIN MENU---\
n")
print("1. NEW ACCOUNT")
print("2. DEPOSIT
AMOUNT")
print("3. WITHDRAW
AMOUNT")
print("4. BALANCE
ENQUIRY")
print("5. CLOSE AN
ACCOUNT")
print("9. EXIT\n")
ch = input("Select Your Option
(1-8): ")
18 | P a g e
if ch == '1':
createAccount()
elif ch == '2':
depositMoney()
elif ch == '3':
withdrawMoney()
elif ch == '4':
displayBalance()
elif ch == '5':
closeAccount()
# Add conditions for other
options...
elif ch == '9':
print("\nThanks for using our
Bank Management System !!!\n\n")
19 | P a g e
break
else:
print("\nInvalid choice!!!")
except mysql.connector.Error as
err:
print(f"Error: {err}")
except Exception as e:
print(f"Error: {e}")
except KeyboardInterrupt:
print("\nOperation terminated
by the user.")
break
20 | P a g e
finally:
if mycon.is_connected():
cursor.close()
mycon.close()
21 | P a g e
Sampleoutputs:
22 | P a g e
23 | P a g e
24 | P a g e
#to search records:
25 | P a g e
26 | P a g e
#to update record:
27 | P a g e
28 | P a g e
#to delete records
29 | P a g e
30 | P a g e
LIMITATIONS
Limited Error Handling: The code lacks extensive
error handling. While basic try-except blocks are
included, they might not cover all potential errors
that could occur during database operations or user
interactions. This could lead to unexpected
program terminations or incomplete transactions.
Security Vulnerabilities: The code doesn’t
incorporate advanced security measures like
encryption of sensitive data, authentication
mechanisms, or input validation. This makes it
susceptible to security threats such as SQL
injection attacks or unauthorized access to the
database.
Lack of Transaction Rollback: In case of failures
during transactions (like deposit or withdrawal), the
code does not implement transaction rollback
31 | P a g e
mechanisms to revert changes, potentially causing
discrepancies in account balances.
Simplified Data Model: The data model lacks
complexity. For instance, it doesn’t include tables
for transaction logs, user authentication, or detailed
customer information beyond basic account details.
Real banking systems typically manage a broader
range of information.
Limited Functionality: While the code covers
essential functionalities like account creation,
deposit, withdrawal, and balance inquiry, it lacks
more advanced features such as interest
calculations, account management tools, or support
for multiple account types.
No Data Validation: There's a lack of input
validation to ensure the correctness of user inputs.
Invalid inputs might lead to unexpected behavior or
database inconsistencies.
32 | P a g e
Single User Access: The system appears to support
only single-user interaction at a time. In real
banking systems, multiple users simultaneously
access and perform transactions, which this code
doesn’t accommodate.
Database Connectivity Assumptions: The code
assumes a local MySQL database with predefined
configurations. In practical scenarios, databases
might reside on remote servers, and connection
parameters could vary.
Addressing these limitations would involve
enhancing error handling, implementing robust
security measures, expanding the data model,
validating user inputs, supporting multiple user
interactions, and considering broader
functionalities essential for a comprehensive
banking system.
33 | P a g e
BASIC ENHANCEMENTS
Limited Error Handling:
The code lacks extensive error handling. While
basic try-except blocks are included, they might
not cover all potential errors that could occur
during database operations or user interactions.
This could lead to unexpected program
terminations or incomplete transactions.
Security Vulnerabilities: The code
doesn’t incorporate advanced security measures
like encryption of sensitive data, authentication
mechanisms, or input validation. This makes it
susceptible to security threats such as SQL
34 | P a g e
injection attacks or unauthorized access to the
database.
Lack of Transaction Rollback: In
case of failures during transactions (like deposit
or withdrawal), the code does not implement
transaction rollback mechanisms to revert
changes, potentially causing discrepancies in
account balances.
Simplified Data Model: The data model
lacks complexity. For instance, it doesn’t
include tables for transaction logs, user
authentication, or detailed customer
information beyond basic account details. Real
35 | P a g e
banking systems typically manage a broader
range of information.
Limited Functionality: While the code
covers essential functionalities like account
creation, deposit, withdrawal, and balance
inquiry, it lacks more advanced features such as
interest calculations, account management
tools, or support for multiple account types.
No Data Validation: There's a lack of
input validation to ensure the correctness of
user inputs. Invalid inputs might lead to
unexpected behavior or database
inconsistencies.
36 | P a g e
Single User Access: The system appears
to support only single-user interaction at a time.
In real banking systems, multiple users
simultaneously access and perform
transactions, which this code doesn’t
accommodate.
DatabaseConnectivityAssumption
The code assumes a local MySQL database
with predefined configurations. In practical
scenarios, databases might reside on remote
servers, and connection parameters could vary.
Addressing these limitations would
involve enhancing error handling,
37 | P a g e
implementing robust security
measures, expanding the data model,
validating user inputs, supporting
multiple user interactions, and
considering broader functionalities
essential for a comprehensive
banking system.
38 | P a g e
BIBLIOGRAPHY
1. www.google.com
39 | P a g e