If you don't already have MySQL Server + Workbench installed, download them from:
https://dev.mysql.com/downloads/installer/
Make a note of the password you set for the root user.
Open MySQL Workbench (or the mysql command line), connect, and run the
schema file included here (File → Open SQL Script → Run).
This will:
- Create the
gradetrackerDBdatabase - Create the
studentstable - Insert 4 sample rows (2 Pass, 2 Fail)
Open src/main/java/com/mycompany/gradetracker/DBConnection.java and change
if needed:
private static final String URL = "jdbc:mysql://localhost:3306/gradetrackerDB?useSSL=false&serverTimezone=UTC";
private static final String USER = "root";
private static final String PASSWORD = ""; // <-- put your own password here- Replace the files of your old project with the ones here (or open this
project directly:
File → Open Project). - Right-click the project → Clean and Build (this will automatically
download
mysql-connector-jfrom Maven Central, thanks to the<dependency>inpom.xml). - If NetBeans doesn't "see" the new dependency right away: right-click the project → Reload POM (or Reload Project).
Set the Run action to call javafx:run (Properties → Actions → Run Project → Execute Goals: javafx:run),
- Click "+ New Grade", fill in a name, subject, grade (e.g. 7) and date, then Submit.
- Go to the "Pass" screen — the new student should appear there.
- Open MySQL Workbench and run
SELECT * FROM gradetrackerDB.students;— you'll see the new row there, proof that it was actually written to the database.