I'm doing an application that inserts an excel sheet to a table in MySQL, the application is inserting the data well, but the error is that after inserting 149 rows I get this error "An error has been generated when setting the link to the DB.From type: com.mysql.jdbc.exceptionsjdbc4.MySQLNonTransientConnectionException: could not create connection to database server Attempted reconnect 3 times.Giving up "
Could you help me solve that problem?
This is the code of my connection:
public class ConexionMySQL {
String db = "palp";
String url = "jdbc:mysql://localhost/"+ db+"?autoReconnect=true&useSSL=false";
String user = "root";
String pass = "123456";
public Connection Conectar(){
Connection link = null;
try{
//Cargar el DRIVER de conexion con el
//SGDB Mysql
Class.forName("com.mysql.jdbc.Driver");
//Creacion de un enlace hacia la base de datos
link = DriverManager.getConnection(this.url,this.user, this.pass);
}catch (Exception ex){
JOptionPane.showMessageDialog(null, "Se ha generado un"
+ "error al establecer el enlace a la BD."
+ "De tipo: " + ex);
}
return link;
}
}