connects to the MySQL database and return the resource link