add travis yml; move db connection code to try/catch