A simple command-line (CLI) banking application built with pure Java and JDBC. This project demonstrates foundational knowledge of Java, object-oriented programming (OOP), and direct database management using SQL.
The application allows users to create accounts, deposit funds, withdraw money, and transfer funds between accounts, all powered by a MySQL database.
This project was built to master the fundamentals before moving to frameworks like Spring. The key concepts are:
- JDBC (Java Database Connectivity): All database operations are performed using the core Java JDBC API. This includes creating
Connection,Statement, andResultSetobjects. - SQL Transactions (Data Integrity): The fund transfer feature uses SQL transactions. By setting
Connection.setAutoCommit(false), the application ensures that money is only moved if both the withdrawal from the sender and the deposit to the receiver are successful. If either fails, theConnection.rollback()is called to prevent data corruption. - Object-Oriented Programming (OOP): The system is modeled with classes like
User,Account, andBankServiceto organize logic and manage data. - Exception Handling: Uses
try-catch-finallyblocks to properly manageSQLExceptions and ensure that database connections are always closed (even if an error occurs) to prevent resource leaks.
- Create a new user account.
- Deposit money into an account.
- Withdraw money from an account.
- Transfer funds safely from one account to another (uses SQL transactions).
- Check account balance.
- Language: Java
- Database: MySQL
- Driver: JDBC (MySQL Connector/J)