Connecting to your PostgreSQL database
This page covers PostgreSQL databases. Your database is reachable from anywhere: your laptop, a build running on another provider, an application you host yourself. What it needs is the connection string PivoCloud generated for it. One honest thing to know before you paste it anywhere. Not every client library accepts this string unchanged, and the settings each one needs are on this page. Read the string first, then the section for the library you use.The connection string
This is the shape PivoCloud hands you:Where to find it
Open your database from the console. TheConnection section holds it, under
the heading External connection string. It stays masked until you ask for
it:
Revealfetches the string and shows it.Copyputs it on your clipboard.
The database name is always the same
Every PostgreSQL database on PivoCloud is namedpivodb. That name is fixed
and it is not something you pick when you create the database.
It is also not the name you typed on the creation form. That one is the label
the console lists your database under, so you can tell your databases apart.
It never reaches the server, and a client asking for it will not find it.
The port
The port to connect on is the one in the connection string,5432, and
nothing else.
If you are filling in a client that wants host, port, user and password as
separate fields, take all four from the string. Any other number you see
alongside them is used internally and will not accept a connection from
outside.
The setting your client library needs
Five clients were run against a real PivoCloud database on 2026-09-09, and every setting below is one that connected. Each section names the exact version that was tested, because the correct answer for a client can change with its version, and a version you can check is what makes this page falsifiable. Four of the five take the string unchanged. node-postgres does not. Prisma depends on which of its two connection paths you use: its built-in connector takes the string as it comes, and itsPrismaPg driver adapter runs
node-postgres underneath and inherits its answer. That difference is the
reason this section exists.
node-postgres
The string from the console needs one change. Tested withpg 8.23.0 and
pg-connection-string 2.14.0.
Pasted unchanged, node-postgres refuses to connect:
sslmode=require as an instruction to verify which server answered,
which is not what that setting means in PostgreSQL itself and not something
that can succeed here. The shortest working change is one more parameter on the
end of the string:
sslmode=no-verify asks node-postgres to encrypt the connection without
verifying the server, which is what require already means to the other
clients on this page.
One trap worth reading twice. If you would rather pass an ssl object in
the configuration than change the string, you must also remove sslmode from
the connection string. When both are present the object is thrown away and
every setting you put on it is lost. The two halves look independent and they
are not.
postgres.js
The string from the console works unchanged. Tested withpostgres 3.4.9.
ssl option is needed. postgres.js reads sslmode=require out of the
string itself and negotiates encryption from it. That the session really was
encrypted is not the client’s opinion: the server was asked directly, and it
answered TLS 1.3.
Prisma
The string from the console works unchanged with Prisma’s built-in connector, and needs one change with the driver adapter. Tested withprisma
7.10.0, @prisma/client 7.10.0 and @prisma/adapter-pg 7.10.0.
With the built-in connector, put the string in your datasource url and change
nothing about it:
PrismaPg driver adapter instead, it runs node-postgres
underneath and inherits its answer exactly, so it needs the same parameter:
psycopg
The string from the console works unchanged. Tested withpsycopg 3.3.5,
built against libpq 180006.
sslmode=require: encrypt the
connection, do not verify who answered.
pgx
The string from the console works unchanged. Tested withgithub.com/jackc/pgx/v5 at v5.7.6.
require as psycopg does, which is why
the two behave identically here.
One file on your own machine changes the answer for psycopg and pgx
Both of them follow libpq, and libpq quietly upgradessslmode=require into a
verification mode when a root certificate file happens to exist at
~/.postgresql/root.crt. If you have that file for some other database, these
two clients start verifying, the verification cannot succeed, and a string that
works for a colleague fails for you with no obvious reason. Deleting or
renaming that file restores the behaviour described above.
Two ways a connection fails before any of these settings matter
Connect using the hostname, never an address
Use the hostname exactly as the connection string carries it. If you resolve that hostname to an address and connect to the address instead, the connection does not work. What you get is not a certificate error. It is the connection ending with nothing in it. From a Go client:A connection that asks for no encryption
Changing the string tosslmode=disable does not connect. The connection is
closed. psycopg reports it as:
P1017. Neither message says what refused it, and
this page does not guess. Leave the sslmode parameter as the console hands it
to you, or replace it with one of the settings above.
What these settings do, and what they do not
Every setting above encrypts the connection. Nobody sitting between your application and your database reads the traffic, and each of these sessions was confirmed as encrypted by asking the server itself rather than by trusting the client that opened it. None of them verifies which server answered. The certificate your database presents is generated for that one database and signed by itself, so there is no third party inside it that a client can check it against. That is why a client told to verify has nothing to verify with, and why settingverify-full on its
own does not work here.
The difference is real rather than a formality. A connection that is encrypted
but unverified is protected from being read and is not protected from being
answered by something that is not your database.
You can close that gap yourself, on your own machine, with four commands. Your
database’s certificate is yours to read, and pinning it is the deliberate
version of what libpq does by accident when it finds a root certificate file.
Pin your database’s certificate
Do this once per database.<host> in every command below is the hostname from
your connection string, written exactly as the string carries it.
1. Read the certificate your database presents.
-starttls postgres is not optional. PostgreSQL negotiates encryption after a
short plain preamble instead of answering direct TLS, so without that flag the
command returns no certificate at all. Worse, that failing run still prints
Verification: OK on its way out, because nothing was verified rather than
because anything succeeded. Check that the output carries a depth=0 line
naming your hostname before you believe any success line.
2. Compute the fingerprint.
-CAfile server.crt and it ends differently:
sslmode
out of the connection string, for the reason given in its section above:
sslmode to
verify-full and point sslrootcert at the saved file:
sslmode=verify-full and sslrootcert
pointing at a completely different database’s certificate, it still connected.
So those parameters do not produce verification on that connector at 7.10.0.
What causes that was not established and this page does not guess at it. If you
want a verified connection from Prisma, use the PrismaPg driver adapter with
the node-postgres pin above, which was tested and does refuse the wrong
certificate.
Two things break a pin
Your database being rebuilt. If PivoCloud has to recreate your database somewhere else, your hostname is kept and the certificate is generated again, so the fingerprint changes and a pinned client stops connecting. The fix is step 1 and step 3 again: read the certificate and replace your savedserver.crt. It
is worth knowing this in advance for an unhappy reason. The moment it happens is
the moment your database has just been recovered, which is already a bad enough
day without a client refusing to connect for a reason nobody wrote down.
A restore. A restore gives you a new database with its own hostname, its own
credentials and its own certificate, and it leaves your original untouched. A
pin made against the original does not carry over to it: take the new connection
string from the console and pin the new certificate the same way. The
recovery page covers restoring itself.
pgvector
pgvector is available on every PostgreSQL database here, whatever plan the database is on. Nothing needs to be requested and nothing needs to be upgraded. It is not switched on by default, because an extension is enabled per database. Connect to your database and run this once:vector columns and the similarity operators work as usual, and
the extension survives restarts and backups.