MySWL Error 2005 (HY000): No such host is known

0

When trying to connect the MySQL database through Netbeans, mysql presented error 2005 (HY000) where it says that the host is not known. The problem is that the class is configured with everything necessary to establish the connection, I tried to do it through the MySL shell but still it does not connect, even though it is also configured. I am using the mysql connector java that already comes in MySQL, I installed the part downloading also and presented the same problem

Class data

package connection;

import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger;

public class ConnectionAuditor {

private static final String DRIVER = "com.mysql.jdbc.DRIVER";
private static final String URL = "jdbc:mysql://localhost:3306/dbavaliacaoderisco";
private static final String USER = "admin";
private static final String PASS = "1231";

public static Connection getConnection(){
  try {
        Class.forName(DRIVER);

        return DriverManager.getConnection(URL,USER,PASS);

    } catch (ClassNotFoundException | SQLException ex) {
        throw new RuntimeException("Erro na conexão:", ex);
    }

}
public static void closeConnection(Connection con){
    try{
        if(con!=null){
            con.close();
        }
    }catch(SQLException ex){
        Logger.getLogger(ConexãoAuditor.class.getName()).log(Level.SEVERE, null, ex);
    }
}
    
asked by anonymous 23.11.2018 / 14:47

0 answers