A Java desktop application backed by MySQL, written for the Databases course project at the Department of Advanced Computing Sciences, Maastricht University, 2025-2026.
Quackstagram is a small social platform: accounts, image posts, likes, comments, follows and notifications. The course supplied a Swing interface that kept everything in text files. This project replaces that storage with a relational MySQL database, adds views, triggers and stored routines, and includes twenty standalone SQL query programs.
| Path | Contents |
|---|---|
src/main/java/quackstagram/model/ |
Database access layer, one store class per entity |
src/main/java/quackstagram/ui/ |
Swing interface - course-supplied skeleton, database integration added |
src/test/java/quackstagram/ |
The JUnit suite |
sql/ |
Schema, seed data, views, triggers, and setup.sql to load them in the right order |
queries/ |
Twenty standalone programs, Query1.java to Query20.java |
img/ |
Icons, logos, and the profile and post images the seed data refers to |
submission 1/ |
First-submission report and a manual database connection check |
appendices/ |
Query timings before and after adding indexes on likes.post_id and follows.following_username |
docs/ |
The course's original project README, kept for reference |
- JDK 21 - tested with Temurin 21.0.8 and OpenJDK 21.0.10
- MySQL 8 - tested against 8.0.46 and 8.4.8
- Maven 3.9 - for the build and the test suite
- MySQL Connector/J - Maven fetches it. For the manual
javacbuild below, download it from https://dev.mysql.com/downloads/connector/j/ and put the JAR atlib/mysql-connector-j.jar.
The code connects as user BCS1510 with password BCS1510, hard-coded in
src/main/java/quackstagram/model/DBManager.java and in every queries/QueryN.java. Create that
user, or change those constants:
CREATE USER 'BCS1510'@'localhost' IDENTIFIED BY 'BCS1510';
GRANT ALL PRIVILEGES ON quackstagram.* TO 'BCS1510'@'localhost';
FLUSH PRIVILEGES;
Then load the database. setup.sql drops and recreates the quackstagram database, and must
be run from inside sql/:
cd sql
mysql -u BCS1510 -p < setup.sql
It finishes with Quackstagram database setup complete. and leaves 25 users, 45 posts, 30
comments, 103 likes, 52 follows, 35 notifications, 4 views and 3 triggers.
The order inside setup.sql matters. triggers.sql must load after populate_database.sql:
on_like_insert increments posts.likes_count, so loading the triggers first counts every seeded
like twice and invents notifications - and MySQL reports success throughout. setup.sql runs a
pre-flight check first, so starting it from the wrong directory stops before anything is dropped.
mvn package
That compiles the application and runs the test suite, which needs the test database (see Tests below). To build without a database:
mvn package -DskipTests
To build without Maven at all, from the repository root:
javac -d build/app $(find src/main -name "*.java")
That produces 24 class files. In a shell without find, use an argument file instead:
dir /s /b src\main\*.java > sources.txt
javac -d build\app @sources.txt
From the repository root, so the image paths resolve:
java -cp build/app:lib/mysql-connector-j.jar quackstagram.ui.SignInUI
Windows uses ; rather than : between classpath entries. Sign in with any seeded account, for
example checkpointmember / password123. If the database is unreachable the application says
so and exits rather than opening empty screens.
From the repository root:
javac -d build/queries queries/*.java
java -cp build/queries:lib/mysql-connector-j.jar Query2
Query2 needs no input and prints one row per user. Queries that take a parameter read it from
standard input.
The suite runs against a separate quackstagram_test database, so it never touches the one the
application uses. Create it once:
cd sql
mysql -u BCS1510 -p < setup_test.sql
Then:
mvn test
Twenty-five tests over the data-access layer: credential checking, account creation, follow
relationships, and the like/unlike cycle including the stored likes_count staying in step
with the likes table. DBManager reads quackstagram.db.url,
quackstagram.db.user and quackstagram.db.password as system properties and falls back to the
application defaults, which is how the suite is pointed at the test database.
Passwords are stored as salted PBKDF2-HMAC-SHA256 hashes; the suite checks that no seeded account holds a password in the clear and that a crafted username cannot authenticate as a different account.
Verified, not hypothetical:
- Test coverage is limited to the data-access layer. The Swing interface has no
automated tests. The application refuses to start when the database is unreachable,
but a failure during a session is logged to the console rather than shown to the
user.
submission 1/DBConnectionTest.javais a manual connection check kept for the record rather than a test: it prints what it finds and always exits 0, including when theuserstable is missing entirely. - Query1 and Query20 run identical SQL. The coursework brief specified both as
follower-count thresholds over the
user_follower_statsview, so the duplication comes from the specification rather than from the code.
Part of this repository was supplied by the course rather than written by its authors - see
NOTICE for which files. docs/original-course-README.md is the course's original
project README, kept for reference; its account of data/credentials.txt and text-file storage
describes the starting point, not this code.
The authors' own work is MIT licensed. See LICENSE.