A Java Swing-based parking management system with MySQL database integration.
- Vehicle Entry Management: Record vehicle details (number, owner name, phone, type)
- Vehicle Exit & Billing: Calculate parking fees based on duration and vehicle type
- Real-time Statistics:
- Available parking slots
- Total revenue
- Occupancy rate
- Search Functionality: Filter parked vehicles by number or type
- Parking Rates:
- Motorcycle: Rs. 20/hour
- Car: Rs. 50/hour
- Van: Rs. 80/hour
- Bus/Truck: Rs. 150/hour
- Java Development Kit (JDK) - Version 8 or higher
- NetBeans IDE - Version 12 or higher (recommended)
- MySQL Server - Version 5.7 or higher
- MySQL Connector/J - JDBC driver for MySQL
- Download and install MySQL from mysql.com
- During installation, set the root password (or leave it empty for development)
- Start the MySQL service
-
Open MySQL Command Line Client or MySQL Workbench
-
Run the SQL script located at
database_setup.sql:source C:/Users/Dilushan/Documents/NetBeansProjects/VehicleParkingSystem/database_setup.sql
Or manually execute the commands in the file.
-
Verify the database was created:
SHOW DATABASES; USE parking_system; SHOW TABLES;
- Download MySQL Connector/J from MySQL Downloads
- Extract the JAR file (e.g.,
mysql-connector-java-8.0.33.jar) - In NetBeans:
- Right-click on your project → Properties
- Select Libraries → Compile tab
- Click Add JAR/Folder
- Browse and select the MySQL Connector JAR file
- Click OK
The application connects to MySQL with these default settings:
- Host: localhost
- Port: 3306
- Database: parking_system
- Username: root
- Password: (empty)
If your MySQL configuration is different, update the connection strings in cardContainer.java:
Connection conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/parking_system",
"root", // Change username if needed
"" // Change password if needed
);- Open the project in NetBeans
- Right-click on the project and select Run (F6)
- Or right-click on
LoginForm.javaand select Run File (Shift + F6)
cd C:\Users\Dilushan\Documents\NetBeansProjects\VehicleParkingSystem\src
javac -cp ".;path\to\mysql-connector-java-X.jar" LoginForm.java
java -cp ".;path\to\mysql-connector-java-X.jar" LoginForm- Enter vehicle details:
- Vehicle Number (required)
- Owner Name (optional)
- Phone Number (optional)
- Vehicle Type (select from dropdown)
- Click Park button
- The vehicle will be added to the parked vehicles table
- Select a vehicle from the table
- Click Exit button
- A receipt will be displayed showing:
- Vehicle number
- Parking duration (in hours)
- Rate per hour
- Total fee
- The vehicle status will be updated to "EXITED"
- Type in the search field to filter vehicles by number or type
- The table updates automatically as you type
1. "No suitable driver found" error
- Ensure MySQL Connector JAR is added to project libraries
- Verify the JDBC URL format is correct
2. "Access denied for user" error
- Check MySQL username and password in the code
- Verify MySQL service is running
3. "Unknown database 'parking_system'" error
- Run the
database_setup.sqlscript - Verify database was created:
SHOW DATABASES;
4. Table not displaying data
- Check database connection
- Verify data exists:
SELECT * FROM parked_vehicles; - Check for exceptions in NetBeans output window
5. Spelling errors in UI
- All spelling errors have been fixed in the latest version
- If you see "Vehicala" or "Enty", rebuild the project
VehicleParkingSystem/
├── src/
│ ├── cardContainer.java # Main parking management panel
│ └── mainFrame.java # Main application frame
├── database_setup.sql # Database creation script
├── mysql-connector-java-X.jar # MySQL JDBC driver
└── README.md # This file
| Column | Type | Description |
|---|---|---|
| id | INT (PK, AUTO_INCREMENT) | Unique identifier |
| vehicle_number | VARCHAR(20) | Vehicle registration number |
| owner_name | VARCHAR(100) | Owner's name |
| phone | VARCHAR(15) | Contact number |
| vehicle_type | VARCHAR(20) | Type (Car, Motorcycle, Van, Bus, Truck) |
| entry_time | TIMESTAMP | Entry timestamp (auto-generated) |
| exit_time | TIMESTAMP | Exit timestamp (NULL if still parked) |
| parking_fee | DECIMAL(10,2) | Calculated fee |
| status | ENUM | 'PARKED' or 'EXITED' |
- User authentication system
- Print receipt functionality
- Daily/Monthly revenue reports
- Configurable parking rates
- SMS notifications
- Barcode/QR code integration
- Multi-floor parking support
This project is created for educational purposes.
Dilushan
For issues or questions, please check the troubleshooting section or contact the developer.