A good relationship with your dog can only be achieved by a consistent education.
Getting him house-trained is a matter of paying attention to his activities.
Take him out after every meal, after he played or when he wakes up!
Reward him when he has done his needs outdoors.
Never punish him, certainly not when you did not catch him in the act.
He doesn't understand what he is punished for, otherwise.
It is advisable to reward good behaviour and ignore bad behaviour.
He will soon understand the idea. Remind him you are in charge and to
bond is more like it than to punish him frequently. He will heel you like
a pup its mother, in other words you are the alpha leader.