I am trying to create a Telegram bot using Heroku and Postgres but I got stuck at connecting to the Heroku Postgres from my local. Here's what I have done so far:
1) Created a Heroku project with the Postgres add-on.
2) I read the Heroku Postgres documentation (https://devcenter.heroku.com/articles/heroku-postgresql) and set up the Heroku CLI and PostgreSQL 11.
3) I followed this tutorial (https://www.youtube.com/watch?v=f76zBj_M5JY) about connecting to Heroku using pgAdmin 4.
The error I received was "could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "ec2-107-22-253-158.compute-1.amazonaws.com" (107.22.253.158) and accepting TCP/IP connections on port 5432?"
4) I googled the error. https://devcenter.heroku.com/articles/heroku-postgresql#external-connections-ingress had the most likely solution. I typed in the commands in Windows Powershell, and I realized the credentials I obtained through this method is exactly the same as the ones I obtained from https://data.heroku.com/ under project > settings > credentials. I have already done this in step 3.
5) https://dba.stackexchange.com/questions/21869/connecting-pgadmin3-to-postgres-on-heroku mentions that the Maintenance Database value has to be the name of the database I want to connect to. I have already done that in step 3.
6) pgAdmin 4 Query Tool not connecting to database did not have a solution to my case, although his/her problem seems to be similar.
At this point, most of the solutions available by googling seem to be the same and I have already tried all these. I have also tried the psql CLI and got the same error as the one in pgAdmin. As I am new to both Heroku and Postgres, any help would be much appreciated!