I am trying to set up a connection between Eclipse and MySQL. However, I am getting java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
exception again and again. I have already imported the mysql-connector-java
into my build path and I still get the same error.
package br.com.agenda.factory;
import java.sql.Connection;
import java.sql.Driver;
public class ConnectionFactory {
// Nome do usuário do mysql
private static final String USERNAME = "root";
// Senha do banco
private static final String PASSWORD = " ";
//Caminho do banco, porta, nome do banco
private static final String DATABASE_URL = "jdbc:mysql://localhost:3307//agenda";
/*
* Conexão com o banco de dados
*/
public static Connection createConnectionToMySQL() {
Class.forName("com.mysql.jdbc.Driver");
return null;
}
}
In the image you can see the connector in my "referenced libraries"