Add database connection function. Don't know if it works yet.