Visual Studio Code

Microsoft's PostgreSQL extension for Visual Studio Code (VSCode) allows you to connect to from VSCode and use it as a SQL client to query your data on

Connecting to with Visual Studio Code

First, install the PostgreSQL extension from the Extensions marketplace.


Next, navigate to "SQLTools" in the left sidebar and click "Add new connection."


Select "PostgreSQL" from the next menu. This will prompt you to fill in the connection details for the database to which you're connecting. All of the details you need are available in the Connect Tab of the database page on

There are two different ways you can connect.

First, you can select "Connection String" from the "Connect using*" dropdown. Copy your Connection string from your database page's connect tab into the "Connection String" field in VSCode, change "SSL" to "Enabled."



Enable SSL

Make sure SSL is set to "Enabled" or you will not be able to connect to your database with VSCode.

Alternately, you can connect using "Server and Port" from the "Connect using" dropdown menu and fill in the connection details individually from the corresponding fields in your database page's Connect Tab. Again, ensure SSL is set to "Enabled" or you will not be able to connect.


Click "TEST CONNECTION." You may be prompted for your password (from the "Password" field of your database's Connect Tab). You should then receive a "Successfully connected!" message, at which point you can click "SAVE CONNECTION" to keep using the connection in the future.

Using VSCode as a SQL Client

Once you've created your connection, click on it in the "Connections" pane in the left sidebar. This will open up a .sql file where you can write and execute queries.


You can also navigate your database's schema, preview tables, and more from the "Connections" pane.


For more details, see the extension's quick-start guide.