example-postgresql icon indicating copy to clipboard operation
example-postgresql copied to clipboard

[oatpp::postgresql::Executor::getConnection()]: Error. Can't connect.

Open techstore56 opened this issue 4 years ago • 3 comments

reproduce:

$ docker build -t example-postgresql . $ docker run -p 8000:8000 -e CONFIG_PROFILE='dev' -t example-postgresql

D |2021-10-20 04:43:45 1634705025742559| Server:Loading configuration profile 'dev' terminate called after throwing an instance of 'std::runtime_error' what(): [oatpp::postgresql::Executor::getConnection()]: Error. Can't connect.

image

techstore56 avatar Oct 20 '21 05:10 techstore56

Hello @techstore56 ,

Most probably you don't have the database running. Make sure that you have PostgreSQL database running at the correct address.

Also, it will be much easier to just run docker-compose up to run both database and the service.

lganzzzo avatar Oct 23 '21 19:10 lganzzzo

<migration.migrate(); // <-- run migrations. This guy will throw on error.> how to deal this error

lizemin5235 avatar Jan 22 '22 14:01 lizemin5235

<migration.migrate(); // <-- run migrations. This guy will throw on error.> how to deal this error

@lizemin5235 , use try - catch

lganzzzo avatar Jan 24 '22 00:01 lganzzzo