Sexual intercourse is a common cause for urinary tract infection and although rare, but, some women like you have an UTI anytime they have sex.
Having frequent UTI's since childhood, diabetes, waiting too long to urinate, are all predisposing factors to develop urinary infection.
You should urinate before and after sex as well as a mean of flushing out any bacteria that may enter the urethra during sexual intercourse.
Also, you can have a shower before and immediately after the sex, for the same effect.
Cranberry juice is well known to reduce the frequency of UTI's and to stop one amazingly quickly after it has started.
Instead drinking a juice, you may buy an over-the-counter cranberry supplements.
Some physicians suggest antibiotics to be taken immediately following sex for women who tend to have frequent UTIs.
Since you find the cranberry juice helpful, there is no need to switch it with drugs (they can cause side effects).
Best wishes!
Marija