Unable to access my PosgreSQL database via my RShiny app (macOS Monterey)

Viewed 16

I'm creating a Shinyapp. I need to read information from a PosgreSQL database hosted on my computer. I have configured PosgreSQL files postgresql.conf and pg_hba.conf as explained here : https://www.bigbinary.com/blog/configure-postgresql-to-allow-remote-connection . On R, this code works fine:

con<-DBI::dbConnect(RPostgres::Postgres(),dbname = mydbname,host = myprivateIP,port = 5432, user = user, password = secret)

map_feature<-pgGetGeom(con, query) etc.

The code works locally on my computer, as on other computers with RStudio + connection,to the same router/wifi.

Tho, when I publish the code and try to make it work through its adress directely online (https://my-code.shinyapps.io/page/)the app crashes, and error message is :

Warning: Error in : could not connect to server: No route to host. Is the server running on host "192.XXX.X.XX" and accepting TCP/IP connections on port 5432?

What am I missing ? Why does it work locally but not from the code hosted online ?

0 Answers
Related