# Postgres Connection Strings and psql

DevFeed: [Postgres Connection Strings and psql](<https://devfeed.tech/articles/postgres-connection-strings-and-psql-34611.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2019/09/postgres-connection-strings-and-psql/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2019-09-04T09:38:02Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Terminal](<https://devfeed.tech/topics/terminal.md>)

Tags: [cli](<https://devfeed.tech/tags/cli.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [environment](<https://devfeed.tech/tags/environment.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [psql](<https://devfeed.tech/tags/psql.md>), [terminal](<https://devfeed.tech/tags/terminal.md>)

## AI overview

This short tutorial explains how PostgreSQL connection strings can use key-value notation, a URI scheme, or psql command-line options with environment variables. It shows that psql can accept a complete connection string, allowing developers to reuse an application's connection string at the console to test a database connection.

## Source excerpt

PostgreSQL connection strings embedded in your application can take two different forms: the key-value notation or the postgresql:// URI scheme. When it comes to using psql though, another form of connection string is introduced, with command line options -h -p -U and environment variable support. In this short article you will learn that you can use either of the three different forms in psql and thus easily copy & paste you application connection string right at the console to test it!