Carpooling system database and web app built around a MySQL schema, with a Tomcat deployment path for local testing. The system supports:
- Create and manage users (passengers and drivers)
- Create, schedule and manage rides (assign drivers and vehicles)
- Book rides as passengers
- Manage vehicles
- Store and retrieve reviews and notifications
- Track activity and audit logs
- Save frequently used routes for quick booking
The database includes 10 tables:
-
Users — Application user accounts and basic profile information.
-
Passengers — Passenger profile data (extends
Users). -
Drivers — Driver profile and verification details (extends
Users). -
Vehicles — Driver-owned vehicle records.
-
Rides — Scheduled ride offerings created by drivers.
-
Bookings — Passenger reservations for rides.
-
Reviews — Ratings and comments for rides/drivers.
-
Notifications — Messages delivered to users.
-
Saved_Routes — User-saved origin/destination pairs for quick reuse.
-
Logs — Audit and activity records for user and system actions.
Key design notes:
- ISA relationship
PassengersandDriversare subclasses ofUsers- They share the same primary key (
User_ID)
- Data integrity
- Foreign keys enforce relationships between tables
Bookings,Rides,Reviews,Notifications,Logs,Saved_Routes,Passengers,Drivers, andVehiclesare linked through primary key and foreign key constraints
- Java 21
- Jakarta/Servlet-based web app with JSP views
- Maven 3.8+
- Apache Tomcat 9.x
- MySQL 8.4 with JDBC via
mysql-connector-j - MySQL Workbench for schema design and inspection
- BCrypt for password hashing
Follow these steps to prepare the database and run the web app locally.
- Open MySQL Workbench.
- Create or select a schema (example:
team7). - Run the SQL schema file to create tables and insert sample data.
Or open and run sql/schema.sql in MySQL Workbench.
Refresh the schema in your client if the tables do not appear.
The web app reads DB connection info from environment variables. Set these before starting Tomcat:
- For Tomcat, create
$CATALINA_HOME/bin/setenv.shwith the exports
export DB_URL="jdbc:mysql://localhost:3306/team7"
export DB_USER="root"
export DB_PASSWORD="yourpassword"Prerequisites: Java 21, Maven 3.8+, Apache Tomcat 9.x
Set your Tomcat home directory once in your shell:
export CATALINA_HOME=/path/to/apache-tomcat-9.0.xxYou can add this to your shell profile, for example ~/.zshrc, so it is always available.
Build and deploy the WAR to the local Tomcat root with the provided Maven profile:
mvn -Pdeploy-local-tomcat packageThis will build target/ROOT.war and copy it to $CATALINA_HOME/webapps/ROOT.war.
Start Tomcat:
$CATALINA_HOME/bin/startup.shOpen the app at:
After code changes, run the same Maven command to publish updates:
mvn -Pdeploy-local-tomcat packageStop Tomcat:
$CATALINA_HOME/bin/shutdown.sh