Yes, look at it I have it in the following way:
public void borrarPersona(String dni) {
Connection c = null;
PreparedStatement preparedStatement = null;
//Usando consultas preparadas, más seguras y más rápidas
String insertSQL = "DELETE "
+ "FROM personas"
+ "WHERE dni LIKE ?";
try {
c = iniciarConnection();
preparedStatement = (PreparedStatement) iniciarConnection().prepareStatement(insertSQL);
preparedStatement.setString(1, dni);
preparedStatement.executeUpdate();
System.out.println("Registro con dni:"+dni+" ha sido borrado");
} catch (Exception e) {
}
}
The System.out.println never comes out, I have also checked it in the database but it does not come out