Make database connection just in time