stomach ulcers need to be treated by your gp with anti ulcer drugs, avoid aspirin and any other drugs that can irritate the ulcer, eg, anti inflamatories, ibuprphen etc. my ulcer took months to heal, avoiding certain irriitants did help, spicy food, alcohol, and acid foods such as citrus fruit. i found that sipping milk slowly eases sudden ulcer pain, however dairy products can cause acid build up in the long run, so do take prescribed medicines.
Stomach ulcers are caused by the bacteria h.pylori. There is a combination of antibiotics that has a good chance of curing the infection. They are usually sold as "PrevPac" and you take them for 10-14 days, depending on what your doctor says.
However, stomach pain is not always caused by an ulcer. Antibiotics will not help with other causes, and could possibly even make your stomach pain worse. Be sure to talk to your doctor.