VOOZH about

URL: https://www.geeksforgeeks.org/java/mini-banking-application-in-java/

⇱ Mini Banking Application in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Mini Banking Application in Java

Last Updated : 24 Apr, 2026

This mini banking application uses JDBC to connect and interact with a database for managing user accounts and transactions. JDBC enables executing SQL operations and handling transactions reliably.

In JDBC, a transaction is treated as a single unit of work. By setting setAutoCommit(false), multiple SQL statements can be grouped and changes are only saved with commit(). If any statement fails, a rollback ensures data consistency.

The application provides a menu-driven console interface allowing users to:

  • Create an account
  • Log in
  • View balance
  • Transfer money to another customer

Prerequisite

Step-by-Step Implementation

Step 1: Eclipse Project Setup

1. Create Java Project:

  1. Open Eclipse.
  2. File -> New -> Java Project ->Name it MiniBankingApp.

2. Create Package

  • Right-click src-> New ->Package ->Name it: banking.

3. Create Java Classes

Inside banking package, create:

  • bank.java
  • bankManagement.java
  • connection.java

Project structure:

👁 Image

4. Add MySQL JDBC Connector

  1. Download MySQL JDBC Connector .jar file.
  2. Create a folder lib in your project.
  3. Copy .jar into lib.
  4. Right-click project -> Build Path ->Configure Build Path -> Libraries -> Add External JARs >->select the connector.

Step 2: Database Setup (MySQL)

Create Database name bank

CREATE DATABASE BANK;

Create Table name customer

👁 out
output

Step 3: Create DataBase Connection Class

This class is used to load the JDBC driver and establish DB connection.And It use DriverManager.getConnection() with MySQL credentials.

connection.java

Step 4: Business Logic Class

This class handles core operations like account creation and fund transfer. Use PreparedStatement for secure, parameterized queries.

bankManagement.java

Step 5: User Interface Class

This class provide a user-friendly, text-based menu to perform banking operations.

Options include.

  • create account.
  • login.
  • view balance.
  • transfer money.

bank.java

Step 6: Run the Application

Run bank.java from Eclipse to launch the menu-driven interface. Test various features like account creation and money transfer.

===============================

Welcome to InBank

===============================

1) Create Account

2) Login Account

3) Exit

Enter Choice: 2

Enter Username: pritesh

Enter Password: 123

Hello, pritesh! What would you like to do?

1) Transfer Money

2) View Balance

3) Logout

Enter Choice: 2

-------------------------------------------------

Account No Customer Name Balance

112 pritesh 1000.00

-------------------------------------------------

Enter Choice: 1

Enter Receiver A/c No: 110

Enter Amount: 5000

Insufficient Balance!

Transaction failed! Please try again.

Enter Choice: 3

Logged out successfully.

Returning to main menu.

👁 out1
👁 out2



Comment
Article Tags: