Poco::Data::Session how create file database?

34 Views Asked by At

I use the POCO library and I need to create a database SQLite at the beginning of my program so that I can then write and read data into it. How can I do it? I wrote the following code:

std::filesystem::path data_root_path("var/opt");
auto data_dir_path = data_root_path / "agent" / "data" / "module";
auto database_file = data_dir_path / "database.db";
// register SQLite connector
Poco::Data::SQLite::Connector::registerConnector();
database_ = Poco::makeShared<Poco::Data::Session("SQLite",database_file.string());

But I get the following error: FileNotFound I work on Linux OS, maybe I don't have access rights to create a database file? How can I check this? I gave the local user write access to the folder.

Could you tell me how to create a database file using the library POCO?

0

There are 0 best solutions below