Generating database