Я пытаюсь подключиться к базе данных MongoDB через jdbc в intellij, получая ошибку как
java.lang.ClassNotFoundException: com.mongodb.jdbc.MongoDriver
Я добавил зависимости:
"org.mongodb" % "mongo-java-driver" % "3.9.1",
"org.mongodb" % "mongodb-driver-sync" % "3.8.2"
Код выглядит следующим образом:
public class PlainQueryRepository {
Connection connection = null;
public void createConnection() throws SQLException {
try {
Class.forName("com.mongodb.jdbc.MongoDriver");
connection = DriverManager.getConnection("mongo://127.0.0.1:27017/hybrid-flow");
} catch (ClassNotFoundException e) {
System.out.println("ERROR: Unable to load SQLServer JDBC Driver");
e.printStackTrace();
return;
} finally {
if (connection != null) connection.close();
}
}
public static void main(String[] args) throws SQLException {
PlainQueryRepository obj = new PlainQueryRepository();
obj.createConnection();
}
}
Может кто-нибудь, пожалуйста, помогите мне с этим.