A desktop banking application built with Java Swing and MySQL database connectivity. Successfully tested and working with MySQL 5.1.33.
- Application: Fully functional and tested
- Database: Connected and working with MySQL 5.1.33
- Authentication: Admin and user login working
- Features: All banking operations implemented
- Admin login with username/password authentication
- View and approve/reject pending user registrations
- View all user accounts and balances
- Manage loan requests (approve/reject with automatic balance updates)
- Real-time data refresh capabilities
- Tabbed interface for easy navigation
- User registration with admin approval workflow
- Secure user login (only approved users can access)
- Deposit and withdraw money with balance validation
- Real-time balance checking
- Loan application system
- Transaction logging with timestamp
- Frontend: Java Swing (GUI)
- Backend: Core Java with JDBC
- Database: MySQL 5.1.33 (compatible with older versions)
- Database Driver: MySQL Connector/J 5.1.49 (optimized for MySQL 5.1.x)
banking-system-java-mysql/
βββ src/ # Source code directory
β βββ Main.java # Application entry point & main menu
β βββ DBConnection.java # Database connectivity & connection management
β βββ AdminLogin.java # Admin authentication interface
β βββ AdminDashboard.java # Admin management dashboard (tabs interface)
β βββ UserLogin.java # User authentication & login interface
β βββ UserRegistration.java # New user registration form
β βββ UserDashboard.java # User banking operations interface
β βββ Transaction.java # Transaction processing & database operations
β βββ Loan.java # Loan management & approval logic
β βββ DemoDBConnection.java # Demo database connection (alternative)
βββ lib/ # External libraries
β βββ mysql-connector-java-5.1.49.jar # MySQL JDBC driver (compatible with 5.1.x)
βββ database_setup.sql # Main database schema & table creation
βββ fix_mysql_auth.sql # MySQL authentication fix script
βββ setup_database.bat # Interactive database setup guide
βββ run.bat # Compile & run application script
βββ MYSQL_SETUP_GUIDE.md # Comprehensive database setup guide
βββ MYSQL_TROUBLESHOOTING.md # Common issues & solutions
βββ README.md # Project documentation (this file)
βββ .gitignore # Git ignore rules
- Main.java: Entry point with main menu (Admin/User login options)
- Authentication Layer: Separate login systems for admin and users
- Admin Module: Complete user management, account approval, loan management
- User Module: Registration, banking operations, loan applications
- Database Layer: JDBC-based MySQL connectivity with transaction support
- GUI Layer: Java Swing components with event-driven architecture
- Java JDK 8 or higher
- MySQL Server 5.1.33 (or compatible version)
- MySQL Connector/J 5.1.49 (already included in
lib/folder)
Option A: Using MySQL Command Line Client
- Open MySQL Command Line Client
- Enter your root password
- Copy and paste these commands:
CREATE DATABASE IF NOT EXISTS banking_system;
USE banking_system;
CREATE TABLE IF NOT EXISTS admin (
admin_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL,
password VARCHAR(100) NOT NULL
);
INSERT INTO admin (username, password) VALUES ('admin', 'admin123');
CREATE TABLE IF NOT EXISTS users (
user_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password VARCHAR(100) NOT NULL,
balance DOUBLE DEFAULT 0,
status ENUM('Pending','Approved','Rejected') DEFAULT 'Pending'
);
CREATE TABLE IF NOT EXISTS transactions (
txn_id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
type ENUM('Deposit','Withdraw') NOT NULL,
amount DOUBLE NOT NULL,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(user_id)
);
CREATE TABLE IF NOT EXISTS loans (
loan_id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
amount DOUBLE NOT NULL,
status ENUM('Pending','Approved','Rejected') DEFAULT 'Pending',
request_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(user_id)
);
SHOW TABLES;Option B: Import SQL File
mysql -u root -p < database_setup.sqlThe application is configured for MySQL root password "123". If your password is different:
- Open
src/DBConnection.java - Update this line:
private static final String PASSWORD = "your_mysql_password";
Option A: Using Batch File (Recommended)
# Double-click run.bat or execute:
run.batOption B: Manual Commands
# Compile
javac -cp "lib/mysql-connector-java-5.1.49.jar" src/*.java
# Run
java -cp "src;lib/mysql-connector-java-5.1.49.jar" Main- Username:
admin - Password:
admin123
- Host:
localhost:3306 - Database:
banking_system - Username:
root - Password:
123(update in DBConnection.java if different)
- Login: Click "Admin Login" β Enter admin credentials
- Approve Users: Go to "Pending Accounts" tab β Select user β Click "Approve"
- View All Users: Check "All Users" tab for complete user list
- Manage Loans: Use "Loan Requests" tab to approve/reject loan applications
- Register: Click "User Login" β "Register" β Fill details with initial deposit
- Wait for Approval: Admin must approve your account
- Login: Use email and password after approval
- Banking Operations:
- Deposit: Add money to account
- Withdraw: Remove money (with balance validation)
- Check Balance: View current account balance
- Apply for Loan: Submit loan requests for admin approval
- admin: Admin credentials (1 default admin)
- users: User accounts with approval status
- transactions: All deposit/withdraw operations
- loans: Loan applications and their status
- Tested with: MySQL 5.1.33-community
- Driver:
com.mysql.jdbc.Driver(legacy driver for older MySQL) - Connection URL:
jdbc:mysql://localhost:3306/banking_system?useSSL=false&autoReconnect=true
- SQL injection prevention using PreparedStatements
- Transaction rollback on database errors
- Balance validation for withdrawals
- Admin approval workflow for new accounts
- Password-based authentication
- Check: MySQL service is running
- Verify: Database password in
src/DBConnection.java - Ensure:
banking_systemdatabase exists
- "Access denied": Wrong MySQL password
- "Unknown database": Run database setup commands
- "Table doesn't exist": Execute CREATE TABLE commands
- Restart MySQL service
- Verify database setup using MySQL Command Line Client
- Check password in DBConnection.java matches your MySQL root password
- β Application starts without errors
- β Admin login works (admin/admin123)
- β User registration creates pending accounts
- β Admin can approve/reject users
- β Approved users can login
- β Deposit/withdraw operations work
- β Loan applications and approvals function
- β Balance updates correctly
- β Transaction logging works
- Password encryption (currently plain text)
- Transaction history view for users
- Email notifications for approvals
- Interest calculation for loans
- Account statements generation
- Multi-currency support
- User profile management