Let's get started with a MySQL Database connection program!
- Login to your Repl.It account.
- Click on:
Languages
- In the
Popular
section choose: Java: A concurrent, class-based, statically typed object-oriented language.
- Click the
pencil
icon next to your repl name.
- In the
Default name:
input box type: Movies
- Delete all the lines of code provided as an example.
- 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)
Movies
Class Output