Slightly more efficient way to open the database connections