Cannabis will decrease stress levels, which is an excellent way to combat ulcers, but without more specifics on your type of ulcer, and its location, that general answer is all I have.
In general, cannabis is a homeostatic agent, and decreases the body's odd tendency to work against itself, which is the root cause of many ulcers, when things get unbalanced in the duodenal or alimentary regions, for whatever reason.
If you fear that smoking it is causing you difficulties, perhaps you should try consuming edibles. But without knowing a specific type of ulcer, and it's cause, you are shooting blindly blaming anything for it, really. Diet is the most likely culprit, many ulcers are the result of undiscovered food allergies and sensitivities.
Anecdotal though it may be, I can say I have heard many people speak of their ulcers, and acid reflux being lessened, or eradicated, by using cannabis to soothe their rough edges and balance their chi a little bit better, or simply get their digestion back on track.
Seek out your physician, and get a more thorough check up, and if possible let us know how you improve, with or without cannabis. If you have been to two ER's over this problem, it could be serious, and ulcerative colitis can damage you permanently, even be lethal.Ulcerative colitis: Symptoms - MayoClinic.com