Compose Database-as-a-Service Help and Documentation

Everything you need to know about Compose, Hosted or Enterprise, is here in our help system. Whether you run one database for your businesses' sole application or six different databases to support an entire corporation, we've got the information you need.

Connecting to PostgreSQL

Getting a connection string

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:

postgres://[username]:[password]@[host]:[port]/[database]

You can find this connection string on your PostgreSQL deployment's Overview page:

Getting the admin password

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.

Connecting with a language's driver

Postgres has a vast array of language drivers. The table covers a few of the most common.

Language
Examples

PHP

Ruby

Ruby on Rails

Python

C#

Go

Connecting with the command line

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).

You can read more about psql in the PostgreSQL documentation - reference - and a simple introduction in Postgres Guide.

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.

Use the "Show credentials" button to reveal the username / password for authenticating to your database.

Connecting with pgAdmin3

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:

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:

Change SSL to "require". Click "OK" to save the connection settings and connect to the database.


Still Need Help?

If this article didn't solve things, summon a human and get some help!

Connecting to PostgreSQL