Database connection test function moved