Dromediansk
Dromediansk

Reputation: 21

'Connection timed out' when connecting on heroku database using 'pg:psql' command

I am trying to connect to my database on heroku, which I would use on my app. I'm using either Command Line or Git Bash on windows.

I have created database on heroku named postgresql-rectangular-87454 and installed Postgres without any errors.

Typing heroku addons I'm making sure, database is set up:

$ heroku addons

Add-on                                            Plan       Price  State
────────────────────────────────────────────────  ─────────  ─────  ───────
heroku-postgresql (postgresql-rectangular-87454)  hobby-dev  free   created
 └─ as DATABASE

but when I try to connect it via heroku pg:psql or also heroku pg:psql postgresql-rectangular-87454 --app salty-shelf-36209, I get this error:

$ heroku pg:psql
--> Connecting to postgresql-rectangular-87454
psql: could not connect to server: Connection timed out (0x0000274C/10060)
        Is the server running on host "ec2-54-225-97-112.compute-1.amazonaws.com" (54.225.97.112) and accepting
        TCP/IP connections on port 5432?

Any advice would be appreciated. Thank you!

Upvotes: 0

Views: 2786

Answers (1)

jmccartie
jmccartie

Reputation: 4976

Without knowing more, my first guess would be network rules -- that the connection is being blocked by a local firewall. The pg:psql command simply grabs the DATABASE_URL from your application config and passes the connection string to your local psql command to create the connection. If you're behind a corporate firewall, you may need to speak with your IT department about making an outbound connection.

Upvotes: 3

Related Questions