Allergic reaction to bactrim?

Patient: 3years ago I took bactrim for prostatitis for 28 days with no problems. I took it again 2 months later again for 28 days. No problems while I was on it. Some time after I was already off the bactrim I broke out with hives for about an hour, took nothing and they went away. I am not sure exactly how long I was off probably between 2 weeks and a month. I never even thought the bactrim was a factor but do not know what caused the hives. I am 99% sure I took bactrim again a year ago for 4 days, for a sperm test but can’t say 100%(I was prescribed a Zpack but asked if I could take the bactrim that I already had instead)I was recently prescribed bactrim again for prostatitis and am scared to take it because of a possible allergic reaction. Could the hives have been caused by the bactrim after I was off for at least 2 weeks? And if I did take the bactrim for the 4 days last year and the hives were caused by the bactrim in my second exposure would I defiantly have had a reaction during my 4 day exposure?

Symptoms: Already diagnosed as prostititis

Doctor: The time frame of 2 weeks does not support a link between bactrim and your hives.Your allergic reaction is likely ca used to something you ingested or were exposed to in the 48 hours prior to the onset of hives.I hope this helps