Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue on example site in main.cpp #21

Open
edvinator opened this issue Dec 10, 2018 · 3 comments
Open

issue on example site in main.cpp #21

edvinator opened this issue Dec 10, 2018 · 3 comments

Comments

@edvinator
Copy link

in main.cpp
bool ret = config_manager::from_file(cfg, "./cfg/feather.cfg");

returns false. I have to use a absolute path to the file or ../cfg/feather.cfg then it succeeds

after that the "init" function throws:
terminate called after throwing an instance of 'std::invalid_argument'
what(): init failed
Aborted (core dumped)

when calling
dao_t<dbng>::init(cfg.db_conn_num, cfg.db_ip.data(), cfg.user_name.data(), cfg.pwd.data(),
cfg.db_name.data(), cfg.timeout);

what could fix this issue?
compiler g++ 7.3.0
operating system ubuntu

@qicosmos
Copy link
Owner

qicosmos commented Dec 11, 2018

open the feather.cfg file, you will see some configurations, you should config the database items, for example:

"db_ip": "127.0.0.1",
"user_name": "feather",
"pwd": "12345",
"db_name": "feather",

you should fill the right database ip, user_name, pwd and database name.
It means you should make sure the database has already exist at first.

please check it

@edvinator
Copy link
Author

Hi i created a mysql db before calling init in main.cpp which compiles but it still throws 'std::invalid_argument'. I appreciate your help.

dbng mysql;
mysql.connect("127.0.0.1", "feather", "12345", "feather");

mysql.commit();

init(cfg);

cfg/feather.cfg:
{
"thread_num": 4,
"port": "8080",
"db_ip": "127.0.0.1",
"user_name": "feather",
"pwd": "12345",
"db_name": "feather",
"timeout": 2,
"db_conn_num": 4,
"drop_all_table": 0,
"log_path": "/tmp",
"log_name": "feather.log",
"roll_file_size": 2
}

@qicosmos
Copy link
Owner

qicosmos commented Dec 12, 2018

make sure your database has already run, the error shows that feather can't connet to your databse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants