It doesn't quite work that way, but the answer to your question is that the database is stored in the DNA of immune cells.
Essentially, the newborn cells of the adaptive immune system (B and T-cells) undergo rearrangements of their DNA to produce a incredibly wide variety of receptors.
Then, they go through a selection process - if they react strongly with self, they die (negative selection). After a few more maturation and selection steps, the surviving immune cells are sent throughout the body.
If one of them later binds strongly to something (which is presumably foreign) in the right context, they activate. They trigger an immune response and proliferate. A subset of these daughter cells become essentially immortal - outlasting the immune response they fought in, but ready to quickly mobilize should that foreign substance be encountered again.
So, the memory cells are the hardware, but the rearranged antigen receptor gene they harbor is the information they need to work.