"Stomach" is the correct spelling.
An ache is a pain. A stomachache is a stomach pain. Most people with a stomachache just say they have a stomachache or their stomach hurts.
Gastritis and gastric ulcer are medical terms. If a doctor has diagnosed that you have these conditions, then you should use these names. You can guess but you cannot self-diagnose that you have gastritis or an ulcer.