How to connect Heroku Postgres from Visual Studio Code?

How to connect Heroku Postgres from Visual Studio Code?

1.Install PostgreSQL extension in Visual Studio Code.

https://marketplace.visualstudio.com/items?itemName=ckolkman.vscode-postgres

2. Restart the Visual Studio Code.

3. Create a Folder. Open the Folder from Visual Studio Code. You can save the queries for future references here.

4. Go to Resources Tab in Heroku App and click “Heroku Postgres”.

5. Click Settings. Click Credentials.

6.  Use PostgreSQL: Add Connection to connect to Heroku Postgres.

a. Host from Heroku should be the Name of the Host.

b. User from Heroku should be the Name of the User.

c. Password from Heroku should be the Password of the User.

d. Database from Heroku should be Database(though optional enter it).

e. Use Secure Connection type.

7. Use PostgreSQL: Focus on PostgreSQL view to open the query explorer.

8. Right Click on the connection and select “New Query”.

Sample Query:

SELECT name, phone 
FROM salesforce.account 
LIMIT 5

9. Select the Query. Right Click and click “Run Query”.

Leave a Reply