I have a maven project where I import the mariadb driver directly from a jar file. I'm making a .jar artifact from this project using IntelliJ IDEA. I'm repeatedly getting a java.sql.SQLException: No suitable driver found for jdbc:mariadb://ip:3306/db
error. What changes should I make to my project/setup to make DriverManager
recognize the mariadb driver?
pom.xml
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.7.4</version>
</dependency>
code (note it's not the connection string - I replaced the info)
package com.bremea.packagename.utils;
import java.sql.*;
public class db {
private static Connection connection = null;
public static void init() {
try {
connection = DriverManager.getConnection("jdbc:mariadb://ip:3306/db", "uname", "pass");
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
}