I've seen this question many times here but I couldn´t make my program work with any answer! The problem is basically that i can't connect to my XAMPP server with Eclipse.
String driver = "com.mysql.cj.jdbc.Driver";
String url = "jdbc:mysql//localhost:80/glosario";
String user = "root";
public void conexion() {
{
try {
Class.forName(driver);
java.sql.Connection conexion = DriverManager.getConnection(url, user, "");
if(conexion != null) {
System.out.println("Conectado a la base de datos");
}
} catch (Exception e) {
System.out.println("Error al conectarse a la base de datos");
e.printStackTrace();
}
}
}
This is my code, I tried some recommended variations but neither of them worked for me. I have mysql connector in my classpath also. I am really noob in this area since I am just starting, this is a practice database but I can't even connect to it hehe. I also checked if my XAMPP connection is fine, and it seems that I can enter to the server, so I think the problem is not there. I have the feeling that im making some dumb mistake and I can't see it.
Any help would be very appreciated, thank you!