It also fosters a good bond with your dog. My dogs always trotted along beside me (tethered) while I did dishes, laundry, vacuumed, made beds, and had computer time.
My favorite way to housetrain is called tether training. Take the dogs leash and loop the hook end through the belt loops on your jeans, and then through the handle part of the leash so it is then secured through your belt loop. Then snap the hook on your dogs collar.
Your dog will then be unable to wander away to leave a puddle. Since he will be right next to you at all times when you are home, you will instantly see the circling, sniffing, or squat that precedes the accident.
Clap your hands once loudly and say "NO". Scoop him up or lead him RIGHT outdoors and unhook him to do his business. PRAISE LAVISHLY when he goes outside.
Do not punish indoor accidents unless you catch him RIGHT as he is doing it. And then the only scolding should be a firm and loud NO. Even 1 minute later is too late. The dog will have no understanding of why he is being punished.
Tethering works very well. I've used it to train every single dog I've ever had. You MUST be consistent, though. Tether him at all times when in the house with you. If he must be off the tether, you MUST confine him either to a crate or to a very small area where you can either watch him, or have pee-pee pads down or something else.
It may take a couple of weeks, but it will work if you are consistent, and pay attention to the dogs bathroom cues. He simply can't wander away to have an accident where you can't see it, so you'll have plenty of opportunities to catch and correct him, and praise him when he goes out and does his business as he's supposed to.
Please have a urinalysis performed before you assume that it is totally behavioral. An urinary tract infection can make house breaking twice as difficult.