Closed minhhoai1001 closed 4 months ago
I using drogon on Ubuntu 20.04.
auto dbClient = app().getDbClient(); auto teacherMapper = drogon::orm::Mapper<Teachers>(dbClient); std::vector<Teachers> teachers = teacherMapper.findAll(); for(const auto& teacher : teachers) { int64_t id = teacher.getValueOfId(); std::cout << "ID: " << id << std::endl; std::cout << "First name: " << teacher.getValueOfFirstName() << std::endl; }
I got error: drogon-web: /home/hoai-tran/Documents/study/drogon/lib/src/DbClientManager.h:36: drogon::orm::DbClientPtr drogon::orm::DbClientManager::getDbClient(const string&): Assertion `dbClientsMap.find(name) != dbClientsMap.end()' failed. Aborted (core dumped)
Help me how to fix it.
Did you add dbclient in the configuration file? please paste it here.
Thank you. I forgot uncomment "db_clients" in config.json. It work now.
I using drogon on Ubuntu 20.04.
I got error: drogon-web: /home/hoai-tran/Documents/study/drogon/lib/src/DbClientManager.h:36: drogon::orm::DbClientPtr drogon::orm::DbClientManager::getDbClient(const string&): Assertion `dbClientsMap.find(name) != dbClientsMap.end()' failed. Aborted (core dumped)
Help me how to fix it.