Immune memory is an ability of organisms to potentiate immune responses at secondary infection. Current studies have revealed that innate immunity, as well as adaptive immunity, exhibits the memory character called "trained immunity". Although it is suggested that epigenetic reprogramming plays important roles in trained immunity, its underlying mechanism is not fully understood, especially on the individual level. Here we established experimental systems for detecting trained immunity in Drosophila melanogaster. Namely, training infection with low-pathogenic bacteria enhanced the survival rate of the flies at subsequent challenge infection with high-pathogenic bacteria. We found that among low-pathogenic bacteria, Micrococcus luteus (Ml) and Salmonella typhimurium (St) mediated apparent training effects in fly, but seemed to act through different ways. Ml left training effects even after its removal from flies, while living St persisted inside flies for a long time. Our RNA-Seq analysis revealed that Ml-training enhanced the expression of immune-related genes during the challenge infection, but did not do so without challenge infection. In contrast, St-training maintained high expression of the immune-related genes with or without challenge. These results suggest that training effects with Ml and St were due to memory and persistence of immune responses, respectively. Furthermore, we searched the factor involved in Ml-training and identified a candidate, Ada2b, which is a component of the histone modification complex. We found that the Ada2b RNAi and mutant flies showed dampened enhancement of survival rates after Ml-training. These results suggest that Ada2b is involved in the Drosophila trained immunity.