Added connection validation to prevent MySql timeouts