>>i got this dog to work for me<<
I am afraid this is where your problem lies. To compete with your dog it has to be a partnership.
You need to put in the work to build his trust and his respect before you can expect anything from him. I don't know what type of training you are doing for your obedience but it is not sounding very motivational. Play with him, build teamwork, your problems have nothing to do with his sexual behaviour, but more to do with your relationship with him.
You need to make him believe that you are the best thing in the world and he wants to spend his time trying to please you.
Chill out for a while and play, forget the serious stuff and build that relationship.
Sandra