I can't start "Hellow World, JDBC" app.
public static void main(String[] args) {
String username = "user";
String password = "pass";
String databaseUrl = "jdbc:mariadb://localhost:3306/example";
try{
Class.forName("org.mariadb.jdbc.Driver");
ClassLoader.getSystemClassLoader();
Connection connection = DriverManager.getConnection(databaseUrl, username, password);
} catch (ClassNotFoundException | SQLException throwables) {
throwables.printStackTrace();
}
}
I know then the error in this string. JVM can't find and load class by name, but idea seen this class.
I add mariadb connector as a jar lib. It means then idea will feed classpass to jvm when it compiling.
I also add requires org.mariadb.jdbc;
in module-info.java
, but I have the same error.
I've already tried creating new project. It's don't help me too. I really don't know why the JVM can't reached Driver class