tiene razon
elAntonie, deberias usar preparedstatement, es mas limpio, organizado y legible, es mas te lo voy a hacer para que veas que no es tan dificil
Código PHP:
public ArrayList<accountsDto> ReadByNif (accountsDto accountsdto, String campo) throws SQLException
{
Statement stmt;
ResultSet rs;
Connection con = DriverManager.getConnection(url,login,password);
stmt = con.createStatement();
String orden = "SELECT * FROM ACCOUNTS WHERE NIF = ?";
PreparedStatement ps = con.prepareStatement(orden);
ps.setString(1, accountsdto.getNif());
System.out.println("Se va a ejecutar en la BBDD la orden: "+orden);
rs=ps.executeQuery();
ArrayList <accountsDto> accountsCollection = new ArrayList <accountsDto> ();
while (rs.next())
{
accountsDto account = new accountsDto();
account.setAccountnumber(rs.getInt("ACCOUNTNUMBER" ));
account.setOffice(rs.getInt("OFFICE"));
account.setNif(rs.getString("NIF"));
account.setCreationdate(rs.getString("CREATIONDATE "));
account.setAccounttype(rs.getString("ACCOUNTTYPE") );
account.setAccountkey(rs.getInt("ACCOUNTKEY"));
System.out.println ("Datos de la cuenta: Account "+account.getAccountnumber()+", Office "+
account.getOffice()+", Nif of client "+account.getNif()+", Date of Creation "+
account.getCreationdate()+", Type of account "+account.getAccounttype()+
", key of account "+account.getAccountkey());
accountsCollection.add(account);
}
con.close();
return accountsCollection;
}
Saludos