Fixed database connection caching