Sounds a lot like a stomach ulcer. Could also be a gall bladder since they don't necessarily cause pain solely on the right side. But they usually cause other problems like bile diarrhea.
The only way to find out if you have an ulcer, though, is to see a doctor and see what he thinks. It's the only way, too, to get some medicine for it.