Also, don't try to attach the full length of PE railing if etched in one piece, but separate into sections if needed. If you don't, it will pop off when your hull flexes from temperature changes, movement, etc.
Attach them were? along the seam of hull and deck? drill holes? I am not sure
Along the deck/hull seam is usually good (hides the seam too!) On superstructures the rails typically go along the edges of the deck as well. You don't have to drill holes, just fit the runs of photoetched railing along the top of the surface and secure them there with glue.
I assume you mean securing photoetch rails to the model? People use different approaches; I like to paint the ship and railing separately and apply the rails only after the ship is mostly assembled. I use Elmer's (white) glue to attach them.