Skip to content

Latest commit

 

History

History
40 lines (34 loc) · 1.82 KB

File metadata and controls

40 lines (34 loc) · 1.82 KB

Grade Tracker — Database Edition (JDBC + MySQL)

Step 1: Install MySQL

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.

Step 2: Create the database

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 gradetrackerDB database
  • Create the students table
  • Insert 4 sample rows (2 Pass, 2 Fail)

Step 3: Set up the connection in the Java project

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

Step 4: Open in NetBeans

  1. Replace the files of your old project with the ones here (or open this project directly: File → Open Project).
  2. Right-click the project → Clean and Build (this will automatically download mysql-connector-j from Maven Central, thanks to the <dependency> in pom.xml).
  3. If NetBeans doesn't "see" the new dependency right away: right-click the project → Reload POM (or Reload Project).

Step 5: Run it

Set the Run action to call javafx:run (Properties → Actions → Run Project → Execute Goals: javafx:run),

Checking that everything works

  1. Click "+ New Grade", fill in a name, subject, grade (e.g. 7) and date, then Submit.
  2. Go to the "Pass" screen — the new student should appear there.
  3. 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.