Mains hum of the kind described is often an electromagnetic field (low frequency radio) effect. If the strings are unconnected to the guitar earth, they act as a very inefficient antenna and the current that flows in them transmits hum to the pickups. One solution is to put the guitar in a faraday cage - this works for the pickup connections when you shield the cavities of the instrument, but this is a small effect. This shielding also stops capacitative noise. The practical solution is to ground the strings, bridge etc. to the signal reference point i.e. the ground connection of the instrument.
When the noise stops on touching the bass, this is because you're effectively helping ground the signal. Also, it frequently varies as you rotate the instrument - radio waves are directional.
Another source of interference is magnetic fields. These are weaker but are picked up by large loops (e.g. ground loops when both PA and amp are grounded AND have their grounds connected via the signal lead. This can be cured with a ground lift switch on the SIGNAL line only). Small multiple loops (e.g. pickups) pickup this sort of interference as well, hence humbuckers.