Depending on the driver used by a language, there are a number of different schemes used to express how to connect to PostgreSQL. At Compose, we use a URI format, the Connection string. The connection string is formatted as so:
You can find this connection string on your PostgreSQL deployment's Overview page:
Connection info panel from the Deployment Overview.
The "admin" user credentials are available in the Credentials section of the Connection Info panel. The password is obscured: in order to view it click the "Show" link next to it. Unless you have recently been authenticated by the system, for security you will be prompted for your account password. Other users and passwords can be created from the database browser.
Postgres has a vast array of language drivers. The table covers a few of the most common.
psql is the command line tool to connect to Postgres. To use it, the PostgreSQL client tools will need to be installed on the local system. They can be installed by installing the full PostgreSQL package downloaded from postgresql.org, from your operating systems packages or on MacOS X with brew installed, run
brew install postgresql).
On Compose, we make it simpler to connect by providing you with the command line you need to use in the Connection Info. The
psql line just needs the username substituted in and for you to give the password when prompted.
psql connection string.
Use the "Show credentials" button to reveal the username / password for authenticating to your database.
pgAdmin3 is a popular GUI client for PostgreSQL. It is available from https://www.pgadmin.org/ with cersions for Windows and Mac OS X. Download, install and run it then select "Add Server" on the menu bar to create a new connection. This will show the following dialog:
New Server Registration panel in pgAdmin3. Properties tab.
The details needed to complete this dialog can be found in the Connection Info panel in the overview of your deployment:
- Name: can be anything describing your Postgres deployment. For simplicity, make this the same name as used in Compose.
- Host: this will be from the host part of your connection string.
- Port: this will be from the port part of your connection string.
- Username: this will be the username for either admin or a user you have created.
- Password: this will be the password for either admin (found in the Credentials section) or a user you have created.
After completing the fields, select the "SSL" tab:
New Server Registration panel in pgAdmin3. SSL tab.
Change SSL to "require". Click "OK" to save the connection settings and connect to the database.
If this article didn't solve things, summon a human and get some help!