microsoft / vscode-postgresql

PostgreSQL extension for VSCODE
Other
392 stars 50 forks source link

Save password of Connection #78

Open nrivera22 opened 4 years ago

nrivera22 commented 4 years ago

Steps to Reproduce:

1.How can I save the password of a Connection so I don't have to type it every single time I need to run a query? 2.

sadrok commented 4 years ago

PGSQL Extension Version: 0.3.0 VSCode Version: 1.45.1 OS Version: macOS Catalina

Seconded. It requires a password to be entered every time a connection is made.

atmin commented 3 years ago

settings.json > "pgsql.connections" > [i] > "password"

flowHater commented 3 years ago

As @atmin said, you save your password directly inside of settings.json

"pgsql.connections": [
    {
      "host": "localhost",
      "dbname": "postgres",
      "user": "postgres",
      "password": "postgres",
      "emptyPasswordInput": false,
      "port": "5432",
      "profileName": "pg_localhost",
      "connectTimeout": 15,
      "encrypt": false,
      "applicationName": "vscode-pgsql",
      "hostaddr": "",
      "options": "",
      "sslmode": "prefer",
      "clientEncoding": "",
      "sslcompression": true,
      "sslcert": "",
      "sslkey": "",
      "sslrootcert": "",
      "sslcrl": "",
      "requirepeer": ""
    }
  ]
mmdolbow commented 1 year ago

I've tried several times, but I can't get that trick to work. When I first set up the connection, I get a query editor to successfully run queries. And then when I save the password as suggested above, it appears to work - the connection looks successful - but then I can't get the query to execute, and it's just a simple query like select * from pg_stat_activity;

My connections profile is nowhere near as complex as above. It looks like the following (I've obviously obscured the sensitive parts).

    {
        "host": "**************database.azure.com",
        "dbname": "postgres",
        "user": "********",
        "password": "***********",
        "emptyPasswordInput": false,
        "port": "5432",
        "profileName": "my profile name"
    }

Are the other parameters necessary to "persist" the connection profile?