Factored out mydb logic, ready to add casjobs integration class.