0

When I compile my project file, the result is Cannot Find Symbol, I need help and this is my Java source code.

package com.uts.program;
import java.sql.*;
public class App 
{
public static void main( String[] args )
{
    try
    {

      String myDriver = "org.gjt.mm.mysql.Driver";
      String myUrl = "jdbc:mysql://localhost:3360/universitas";
      Class.forName(myDriver);
      Connection conn = DriverManager.getConnection(myUrl, "root", "");


      String query = "SELECT * FROM mahasiswa";

      Statement st = conn.createStatement();

      ResultSet rs = st.executeQuery(query);


      while (rs.next())
      {
        int id = rs.getInt("nim");
        String nama = rs.getString("nama");
        String jurusan = rs.getString("jurusan");
        String alamat = rs.getString("alamat");


        System.out.format("%s, %s, %s, %s, %s, %s\n", id, nama, jurusan, alamat);
      }
      st.close();
    }
    catch (Exception e)
    {
      System.err.println("Got an exception! ");
      System.err.println(e.getMessage());
    }
}
}

And this is the result when I compile from the terminal on Ubuntu :

enter image description here

This is my folder structure:

Folder Structure

KyleMit
  • 30,350
  • 66
  • 462
  • 664

0 Answers0