I am trying to do a simple link to a database but every time I try to run it it gives me a "no suitable driver error". I am following a tutorial so I'm unsure as to why mine is not working compared to the shown example.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class google {
private static final String USERNAME = "Johns";
private static final String PASSWORD = "done11";
private static final String CONNECTOR = "jdbc:mysql://localhost/grading";
public static void main(String[] args) throws SQLException {
Connection conn = null;
try {
conn = DriverManager.getConnection(CONNECTOR, USERNAME, PASSWORD);
System.out.print("connected");
} catch (SQLException e) {
System.err.print(e);
}
finally {
if (conn != null) {
conn.close();
}
}
}
}
the ecpected output is for it to say "connected", but the error it gives is "java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/grading"