About 85% of ulcers are caused by H pylori bacteria the other ulcers are caused by irritatational type medication like nonsteroid anti-inflammatory drugs even asprin and other things that are stomach irritants.
Gastritis is an inflammation of the stomach lining and can be caused by many things and some does cause ulcers.