Connect to Postgres using DBeaver

Hi,

I’ve tried every help found in the forum and none of them worked… At this point I can use the command “fly proxy 6543:5432 -a ” and get the message “Proxying local port 6543 to remote [app-name.internal]:5432”

It seems everything works up until this point. Now when I try to connect DBeaver I can’t get a successful connection. Can someone give like a step-by-step from this point onwards? Like… getting the db-name (Which I think I have the correct one) and also the user and password for the database?

Thanks!

Hi @Hugo1 !

Im a long time DBeaver user here

Can you comment what’s the error message you’re getting from your DBeaver?

If you’re using fly proxy ... make sure your dbeaver points to localhost too. As for getting the environment variables my suggestion is fly ssh console -a YOUR_DB_APP_NAME and simply run env then you’ll see all envs including username and password.

1 Like

Thanks for you quick reply! So… It’s seems I am missing something.

See if I got the steps right:

  1. fly proxy 6543:5432 -a → Console message: Proxying local port 6543 to remote [app-name.internal]:5432
  2. fly ssh console -a → I can get the OPERATOR_PASSWORD but I don’t see any user… I’ve tried postgres
  3. Opened DBeaver and created a new connection using Host: localhost, Port:6543, Authentication: Database Native, Username: postgres, Password: OPERATOR_PASSWORD
  4. Test Connection Button → Connection Error. Connection Reset

Any other suggestions? I’m sure I’m very close but I’m missing something simple that I can’t seem to find!

This connection reset seems odd. Can you confirm youre using -a PG_DB_APP_NAME instead of, say, your web app?

Here’s a couple other things you can try:

  1. Being under ssh in your PG machine try to psql [credentials] and see if you can connect.
  2. Try fly wg websockets enable and fly wg websockets disable before using fly proxy to see if its a network issue.

First one seems ok :slight_smile: so… I used -a PG_DB_APP_NAME (i was missing the -db) and now I can connect.

Now… The error is FATAL: database “<my_db_name>” does not exist
FATAL: database “<my_db_name>” does not exist

I’m using the OPERATOR_PASSWORD with username postgres.

Awesome! Try using “postgres” as your DB name. If that doesnt work here’s a suggestion to find out:

  1. fly ssh console -a YOUR_WEB_APP
  2. Run env inside your machine
  3. Look for DATABASE_URL it should have something like db-app-name.flycast/DB_NAME.

Yes! Got it… Thanks for tackling down with me.

1 Like

Added postgres

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.