With PREPAREDSTATEMENT
the references of the values are passed to the QUERY
but will there be any way to do it with STATEMENT
?
With prepared statement I do it this way:
String sql = "SELECT * FROM alumons WHERE nombre = ? AND pass = ?";
System.out.println("Query => " + sql);
//Le pasamos los parametros por un ?
ps = con.prepareStatement(sql);
ps.setString(1, per.getNombre());
ps.setString(2, per.getPass());