I am trying to connect to the database using JSP and in eclipse, but I get an error.
I have imported the MySQL libraries, I have put connectors .. and it still does not work, this is the code:
<%@page import="java.util.*"%>
<%@page import="java.sql.*"%>
<%@page import="java.io.*"%>
<%
//Parámetro
String nombre = request.getParameter("nombre-form");
String apellidos = request.getParameter("apellidos-form");
String edad = request.getParameter("edad-form");
String mensaje = nombre + " " + apellidos + " " + edad;
Connection con = null;
Statement set = null;
try{
Class.forName("com.mysql.jdbc.Driver");
con = (Connection)DriverManager.getConnection("jdbc:mysql://localhost/personas","root", "root");
set = con.createStatement();
System.out.print("La conexion se ha aprobado");
}catch(Exception e){
System.out.println("Error en acceso a base de datos" + e);
}
When I try to connect it does not enter me by try
, it makes me catch
,
The error that comes to me is the following:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver