Let's get started with a MySQL Database connection program!
- Open Eclipse
- Right-Click on your
buffalo.edu.fa23..your-username
- Choose:
File -> New -> class
- In the
Name:
textbox type: Movies
- Click:
Finish
- Copy the
Movies.java
Template (Java) code (below)
- Paste that code into your new Movies class in the editor
- Change both occurrences of put-your-username-here
- Replace the blank on the
String password = "_____";
line with:
Temppw23
- After the
while (rs.next()) {
line, add these lines:
System.out.println("\"" + rs.getString(2) + "\"");
System.out.println("\tReleased on: " + rs.getString(3));
System.out.println("\tDirected by: " + rs.getString(4) + ".");
- Click the Run icon
- Change
Boolean DEBUG = false;
to:
Boolean DEBUG = true;
- Click the Run icon and observe the debug messages
Movies.java
Template (Java)