-1

I have a Heroku Ruby app, and I want to access the DB through Navicat, or pgAdmin, or similar. However, the thing that Heroku gives me as a DB URL doesn't seem to be a valid URL.

Heroku tells me to use: heroku config:get DATABASE_URL -a your-app However, that gives me something of the form

postgres://HUGE:STRINGOF@GIBERISH.compute-1.amazonaws.com:5432/MORECHARACTERS

which doesn't look like a valid URL to me, and both Navicat and pgAdmin fail to connect.

How can I use this value to connect to my database?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Brian Postow
  • 11,709
  • 17
  • 81
  • 125

1 Answers1

1

That "huge string of gibberish" is a completely valid URL.

postgres is the scheme, just like https is a scheme.

What you have marked as HUGE is your username and what you have marked as STRINGOF is your password. Together, they make up the userinfo subcomponent.

GIBERISH just is part of the domain, 5432 is the port, and MORECHARACTERS is the name of the database.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Interesting. I didn't know what MORE and MORECHARACTERS were... However, it still doesn't work. maybe without the user info? hmm – Brian Postow May 15 '20 at 13:39
  • Concretely, try connecting to `GIBERISH.compute-1.amazonaws.com` on port `5432` using `HUGE` as your username, `STRINGOF` as your password, and select the database `MORECHARACTERS`. You probably don't need to explicitly include `postgres://` anywhere, but you may have to select the right driver depending on your client. – ChrisGPT was on strike May 15 '20 at 13:41
  • I also recommend enabling SSL. I can't remember if Heroku Postgres enforces that, but if it does that might be why you're not able to connect. – ChrisGPT was on strike May 15 '20 at 13:50
  • interesting. Ok, so now it complains about the password. I've tried what **I** think my password/user name is, and what you suggested, and both failed. I'll put the whole message in the post. – Brian Postow May 15 '20 at 13:56
  • 1
    GRR. I'm dyslexic and flipped which part was the user and which was the password! I think it works now! testing! – Brian Postow May 15 '20 at 14:10