If the puppy is active, he needs to go out more frequently. After 3 consecutive days of success, increase freedom by 15 minutes. Watch your puppy. If accidents happen, you either allowed him too much unsupervised freedom or you have pushed faster than his bladder has developed. If there is an accident, decrease freedom by 15 minutes for 3 days.
Puppies have only a limited control over their bodies.
Anger or punishment for unwanted behavior is counterproductive. You can control your anger if you accept the fact that there will be accidents. Remember that a human baby may be 2 years old before it is housetrained. Praise for correct behavior and ignoring accidents gets the fastest results. Consistency in goals and training methods is crucial.