OHDSI Home | Forums | Wiki | Github

Broadsea: WebApi can not connect to local postgresql DB

We installed Broadsea we followed https://github.com/OHDSI/Broadsea and all the steps we found online. We also filled our local DB with Synpuf dataset.The last step we did was to run Achilles and were expecting for the data to be available in Atlas after. But when we try to see an analysis on Synpuf data we get either report loading error (if we use actually ip of our host server in webapi.source table jdbc url) or we get no data in all analysis (if we use localhost or 127.0.0.1 in webapi.source table jdbc url).’
Our source and source_daimon tables seem to have all correct fields.
When we check the logs in webapi container we get that it is not able to connect to our local database:

2023-06-09 11:59:14.224 ERROR taskExecutor-1 org.ohdsi.webapi.cdmresults.service.CDMCacheService - [] - Failed to warm cache Synpuf. Exception: Could not get JDBC Connection; nested exception is org.postgresql.util.PSQLException: The connection attempt failed. - If jdbc is jdbc:postgresql://actual_host_ip:5432/postgres?user=postgres&password=mypass or jdbc:postgresql://localhost:5432/postgres?

OR

2023-06-09 11:59:14.224 ERROR taskExecutor-1 org.ohdsi.webapi.cdmresults.service.CDMCacheService - [] - Failed to warm cache Synpuf. Exception: Could not get JDBC Connection; nested exception is org.postgresql.util.PSQLException: Connection refused. - If jdbc is jdbc:postgresql://127.0.0.1:5432/postgres?user=postgres&password=mypass

Could someone help us understand what is missing, and why the webapi container can not connect to our local DB?
Thank you!

So this is using your own Postgres, right, not the Broadsea atlasdb? Is it hosted on the same server or elsewhere?

Hello, yes, this is the connection with our own Postgres, which is in the server where we are also running the containers.

Can you post your env file’s Section 3, with passwords redacted?

Hello, sure. It’s below (I tried changing that to the server ip also but in Atlas would give the error Application initialization failed
Unable to connect to an instance of the WebAPI.
Please contact your administrator to resolve this issue.)

Hello, issue has been solved, seemed I could have been just connecting to atlasdb because flyway was migrating everything in our local DB to it. But thanks a lot Ajit_Londhe for making me look to the fact that the webapi was only connecting to the Atlas DB

Great, what was the fix? To me it looked like your Section 3 was pointing to the host name of the atlasdb provided by Broadsea (that URL is the internal name within the docker network), and that it needed to be the host name of your local postgres DB.

The fix turned out to be changing to atlasdb in the webapi.source table. Flyway was migrating our data from our local DB to AtlasDB but I was not aware, there was no need to connect to the local DB.

1 Like

Hi @marianagpina ,

We set the Broadsea, and we are trying to import our own data schema from PostgreSQL. But we are facing same issue you faced before -
Atlas would give the error Application initialization failed
Unable to connect to an instance of the WebAPI.
Please contact your administrator to resolve this issue.

I saw your post that the .env file, Section 03 - WebAPI Database Configuration changes need to be done and later in the post you mentioned the issue is resolved just connecting to atlasdb because flyway was migrating everything.

We are stuck on that step. Can you help us to figure it out?

@dxy257 did you ever get your issue resolved? I’m having what I think is a similar issue. If you resolved things on your end, would you be willing to share what steps you took? I have the Broadsea v3.5 install with default db. But, I want to make a connection to an external PostgreSQL server/db.

t