The cable shield (pin 2) should be connected to ground at the sender, but left open (or AC-grounded through a capacitor, see the Electrical Specification Update
) at the receiver.
If you put a switch in the middle, you should connect the shields together. Furthermore, the shield should not be switched (switch only pins 4 and 5).
It is not possible to have two senders or two receivers connected directly together at the electrical level; for that, you'd need a MIDI Merger or a MIDI Thru box.