Most dogs can be toilet trained, it just takes some longer than others. Be prepared to be patient and to dedicate several days of concentrated attention to training the dog. Remember, some learn faster than others and some dogs have deeply ingrained bad habits which need to be unlearned.
If yours is an adult dog with bad habits, it's a good idea to get him first checked by a vet to ensure there's no medical reason for his antisocial behavior.
It is never appropriate to punish a dog for urinating indoors. While this might serve to give you temporary satisfaction, it will only confuse the dog and make him more devious and secretive about his toilet habits. In truth, it's best to know where he pees, (so you can clean it up) rather than have a dog who secretly goes behind the sofa.
Ultimately, once the dog learns to go outside, you can use a cue word. This is extra helpful as it puts toileting on command, which is great on a wet windy night when you don't want to stand outside forever while the dog thinks about toileting.
You'll also need: