First of all, you should open the keyboard and have a good look at what's actually the problem - i.e. where exactly is something loose. That will also tell you if glue would be enough or you should resolder something. Just be careful - usually the most brittle parts are not actually the solder joints, but the wires and plastic parts inside the connector itself. If that's the case, you'll need to replace the whole connector.