To maintain your sanity, teach him to use puppy pads indoors.

Is it the train which spooks him outside?