You cannot connect to an external database like this. Database running on the server labs.cms.gre.ac.uk will be protected by the firewall and it is internal to the network in which the server is running. Therefore there is no way you will be able to connect to this database.
Even if you connect to a local database you have multiple problems in the code:
- You should add MySQL JDBC driver to your classpath.
- Connect URL you are using is wrong. Connect URL cannot contain a protocol like http:// in it. Please google for MySQL JDBC connect URL format.
Hope that helps!