Gastric ulcers, commonly known as stomach ulcers, are painful sores in the stomach lining. The stomach produces acid to digest food and to kill germs (bacteria). The protective mucus lining in the stomach protects the walls of the stomach from any damage caused by acid production. But if the amount of acid is increased or the amount of mucus is decreased, you could develop an ulcer.