generalized DB connection and API key