I need make a connection between java web and mysql, I am using netbeans but I don't know how.
If I dont write the password I have this fail but if I write the password, the failure is java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
I need help with my code!, this is my code, I am using netbeans!
package conexion;
import java.sql.*;
public class CONEXION_BD {
public static Connection getConexion(){
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection
("jdbc:mysql://localhost/bd_prueba?user=root&password=");
System.out.println("Conexion ok");
}catch(ClassNotFoundException | SQLException e){
System.out.println("Error "+e);
}
return con;
}
public static void main (String[] args){
CONEXION_BD.getConexion();
}
}