private double getExchangeRateFromDB(Currency toCurrency, Currency fromCurrency, Connection connection, Date date) {
        try {
            String query = "select cambio from historico_cambios "
                    + "where divisa_desde='" + fromCurrency.getCode() + "' and divisa_a='" + toCurrency.getCode() + "'";
            ResultSet resulSet;
            resulSet = connection.createStatement().executeQuery(query);
            while (resulSet.next()) 
                return resulSet.getDouble(1);
        } catch (SQLException ex){
            ex.getMessage();
        }
        return 0;
    }