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
The issue was in JDBC driver for mariadb v.2.7.2, 2.7.3, 2.7.4. I solved this problem by simply downgrading to an older version 2.4.4
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.