lazily connect to database