According to the below websites bismuth salicylate (pepto-bismol) is the best over the counter medication. Antacids (Tums, etc.) may or may not be helpful. There are many more powerful 'under the counter medications' available, however. Since bleeding ulcers can be rather serious its important to have a physician check out your ulcer. Plus if your ulcer is caused by the H. pylori bacteria, as most are, the treatment success rates are high.
With an ulcer you should avoid caffeine, alcohol, smoking and NSAIDS such as aspirin, ibuprofen (Motrin, advil, etc) and naproxen. Some people's ulcers are caused by taking too many NSAIDS. NSAIDS interfer with the lining of the stomachs ability to protect itself.