Date: 2025-12-18
Database: MySQL (book_selling_system)
Language: Java (Swing GUI)
IDE: NetBeans
A complete desktop application for buying and selling textbooks with:
- User Registration & Login - Secure account management
- Admin Panel - Add and manage books
- Book Browsing - View all available books
- Order System - Buy books with delivery address
- Booking Management - Track all orders
- Request System - Submit requests and complaints
Everything is saved to MySQL database - no data is lost!
- account - User accounts (registration/login)
- admin_users - Admin accounts (default: Soumya/1234)
- books - Book inventory (new and old books)
- bookings - Book orders with delivery info
- requests - User requests and complaints
- vw_all_books - Books with user who added them
- vw_user_bookings - Complete booking information
Option A - Automated (Recommended):
# Double-click this file:
setup_database.batOption B - MySQL Workbench:
- Open MySQL Workbench
- File β Open SQL Script
- Select
database_setup.sql - Click Execute (β‘)
Option C - Command Line:
mysql -u root -p < database_setup.sqlUSE book_selling_system;
SHOW TABLES;
-- Should show 5 tables: account, admin_users, books, bookings, requestsIf your MySQL has a password, update it in:
DatabaseConnection.java(line 20)Create_ac.java(line 235)Userlogin.java(line 137)Add_new_books.java(line 260)Add_old_books.java(line 260)
Change:
String password = "";To:
String password = "your_mysql_password";π EASIEST WAY - Just double-click:
run.bat
Or use PowerShell:
.\run.ps1Or use NetBeans:
- Open project in NetBeans
- Build Project (F11)
- Run Project (F6)
Or manual command:
# Compile
javac -cp "mysql-connector-java-8.0.18.jar" -d "build\classes" src\Textbook_selling_system\*.java
# Run
java -cp "build\classes;mysql-connector-java-8.0.18.jar" Textbook_selling_system.Main_screenNote: The run.bat and run.ps1 scripts automatically compile and run with the MySQL driver included!
- Click "Admin Login"
- Username:
Soumya - Password:
1234 - Try adding books (both new and old)
- View bookings
- Create a new account
- Login with your credentials
- Browse books
- Buy a book
- Submit a request
-- Check users
SELECT * FROM account;
-- Check books
SELECT * FROM books;
-- Check bookings
SELECT * FROM vw_user_bookings;
-- Check requests
SELECT * FROM requests;Textbook_selling_system/
βββ src/Textbook_selling_system/
β βββ DatabaseConnection.java β
Database connection manager
β βββ Create_ac.java β
User registration β account table
β βββ Userlogin.java β
User login β account table
β βββ AdminLogin.java β
Admin login β admin_users table
β βββ Add_new_books.java β
Add new books β books table
β βββ Add_old_books.java β
Add old books β books table
β βββ BuyBooks.java β
Browse books β books table
β βββ Address.java β
Place order β bookings table
β βββ Show_bookings.java β
View orders β bookings table
β βββ Request.java β
Submit request β requests table
β βββ UserHost.java β
User dashboard
β βββ AdminHost.java β
Admin dashboard
β βββ Main_screen.java β
Main menu
βββ database_setup.sql π Complete database schema
βββ quick_setup.sql π Quick reference queries
βββ setup_database.bat π Automated setup script
βββ DATABASE_INTEGRATION_SUMMARY.md π Complete implementation details
βββ COMPLETE_ANALYSIS.md π Project analysis
βββ DATABASE_SETUP_README.md π Setup instructions
βββ ERROR_FIXES_SUMMARY.md π Previous fixes
βββ README.md π This file
| Feature | Java File | Database Table | Status |
|---|---|---|---|
| User Registration | Create_ac.java | account | β Working |
| User Login | Userlogin.java | account | β Working |
| Admin Login | AdminLogin.java | admin_users | β Working |
| Add New Books | Add_new_books.java | books | β Working |
| Add Old Books | Add_old_books.java | books | β Working |
| Browse Books | BuyBooks.java | books | β Working |
| Place Order | Address.java | bookings | β Working |
| View Bookings | Show_bookings.java | bookings | β Working |
| Submit Request | Request.java | requests | β Working |
ALL FEATURES HAVE COMPLETE DATABASE INTEGRATION!
- Username: Soumya
- Password: 1234
- Username: johndoe | Password: password123
- Username: janesmith | Password: password456
The database includes sample data for testing:
- 2 sample users (johndoe, janesmith)
- 5 sample books (Computer, Physics, English, Maths, Chemistry)
- 1 admin user (Soumya)
- β Database connection
- β User registration
- β User/Admin login
- β Add books (new and old)
- β BuyBooks.java - Now loads books from database (was hardcoded)
- β Address.java - Now saves bookings to database (was only showing message)
- β Show_bookings.java - Now loads bookings from database (was empty)
- β Request.java - Now saves requests to database (was fake ID)
- β database_setup.sql - Added requests table
- README.md (this file) - Quick start guide
- DATABASE_INTEGRATION_SUMMARY.md - Complete implementation details
- COMPLETE_ANALYSIS.md - Project analysis and architecture
- DATABASE_SETUP_README.md - Detailed setup instructions
- ERROR_FIXES_SUMMARY.md - Previous error fixes
- Run
database_setup.sqlto create the database
- Check MySQL username and password
- Update password in Java files if needed
- Ensure
mysql-connector-java-8.0.18.jaris in project libraries - NetBeans: Right-click project β Properties β Libraries β Add JAR
- Ensure MySQL server is running
- Check MySQL is on port 3306
- Add books using Admin panel
- Or check if sample data was inserted:
SELECT * FROM books;
- Place an order first
- Or check database:
SELECT * FROM bookings;
- Login with Soumya/1234
- Click "Add New Books" or "Add Old Books"
- Fill in book details
- Click "Add" - book saved to database
- Click "Show Bookings" to see all orders
- Create account or login
- Click "Buy Books" to see all available books
- Select a book and click "Buy Selected Book"
- Fill in delivery address
- Click "Place Order" - order saved to database
- Click "Request" to submit requests
SELECT * FROM vw_all_books;SELECT * FROM vw_user_bookings;SELECT * FROM vw_user_bookings WHERE status = 'Pending';SELECT * FROM requests ORDER BY request_date DESC;SELECT book_condition, COUNT(*) FROM books GROUP BY book_condition;Before using the application, verify:
- MySQL server is running
- Database
book_selling_systemexists - All 5 tables exist (account, admin_users, books, bookings, requests)
- Default admin user exists (Soumya/1234)
- Sample data is inserted
- MySQL password is configured (if needed)
- JDBC driver is in project libraries
- Project builds without errors
You'll know everything is working when:
- β You can create a user account
- β You can login as user
- β You can login as admin (Soumya/1234)
- β Admin can add books
- β User can see books in BuyBooks
- β User can place orders
- β Admin can see bookings
- β User can submit requests
- β All data persists in database
Check database after each action to verify data is saved!
- Session management (pass user info between screens)
- Password hashing (BCrypt)
- Search and filter books
- Update booking status
- Email notifications
- Sales reports
- Book cover images
- Payment integration
For issues:
- Check console output for errors
- Verify MySQL is running
- Check database credentials
- Review documentation files
- Test with sample data
Educational project for learning Java Swing and MySQL integration.
π CONGRATULATIONS! Your Textbook Selling System is complete and fully integrated with MySQL database!
All data is now properly stored, retrieved, and managed through the database. No more lost information or hardcoded data!
Start the application and test all features! π