ElectraDB
PricingDocsLog in
Get started
Guides

Quickstart: create a managed PostgreSQL database and connect

This guide takes you from sign-up to your first query. You need a card on file: every plan, including Dev, is billed monthly in advance (see pricing).

On this page1. Create the database2. Copy the connection string3. Connect4. Next steps

1. Create the database

  1. Sign up, verify your email and add a card.
  2. Choose Create a database.
  3. Pick a region (EU, US or Asia). Your database, its standby and its backups stay there. Not sure which is closest? Enter your server's public IP address and our servers in each region ping it. See Regions and data residency.
  4. Pick a plan. High-availability plans run on two servers in different sites; single-node plans on one; Dev is a small single-node plan for development and testing. See Plans, resizing and storage limits.
  5. Give it a name and, optionally, an environment label. A database labelled production starts with deletion protection on.

While the database is being set up, its page shows the setup phases and anything it is retrying. It is ready when its status is live: the servers are running, the hostname resolves and the first backup is done.

2. Copy the connection string

The database page shows one connection string:

postgresql://u_k7m2q9:[email protected]:20017/app?sslmode=verify-full
  • The user is the database's owner role, u_<id>, and the database is app.
  • The hostname stays the same for the life of the database, including after a failover or a plan change.
  • The password is shown once, right after the database is created. Store it in your secrets manager. If you lose it, reset it on the database page: a new password is generated and the old one stops working immediately.

High-availability plans also show a read replica connection string on a second port. It reads from the standby, which can be slightly behind the primary, and rejects writes.

3. Connect

The examples read the connection string from the DATABASE_URL environment variable, so the password stays out of your code. TLS is verified against the public certificate authorities your system already trusts.

.env

DATABASE_URL=postgresql://u_k7m2q9:[email protected]:20017/app?sslmode=verify-full
# for drivers that take the password separately (JDBC)
DATABASE_PASSWORD=YOUR_PASSWORD

psql

psql needs libpq 16 or later for sslrootcert=system:

psql "postgresql://u_k7m2q9:[email protected]:20017/app?sslmode=verify-full&sslrootcert=system"

Python (psycopg 3)

# pip install "psycopg[binary]"
import os
import psycopg

# sslrootcert="system": verify the server against your system's certificate authorities
with psycopg.connect(os.environ["DATABASE_URL"], sslrootcert="system") as conn:
    print(conn.execute("select version()").fetchone()[0])

Node.js (pg)

// npm install pg
import pg from "pg";

const client = new pg.Client({ connectionString: process.env.DATABASE_URL });
await client.connect();
const { rows } = await client.query("select version()");
console.log(rows[0].version);
await client.end();

Go (pgx)

// go get github.com/jackc/pgx/v5
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/jackc/pgx/v5"
)

func main() {
	ctx := context.Background()
	conn, err := pgx.Connect(ctx, os.Getenv("DATABASE_URL"))
	if err != nil {
		panic(err)
	}
	defer conn.Close(ctx)
	var v string
	conn.QueryRow(ctx, "select version()").Scan(&v)
	fmt.Println(v)
}

Java (JDBC)

JDBC takes the password separately. DefaultJavaSSLFactory verifies the certificate against the JVM's trusted authorities:

// org.postgresql:postgresql
import java.sql.*;

public class Main {
    public static void main(String[] args) throws SQLException {
        String url = "jdbc:postgresql://k7m2q9.db.electradb.com:20017/app?sslmode=verify-full&sslfactory=org.postgresql.ssl.DefaultJavaSSLFactory";
        try (Connection c = DriverManager.getConnection(url, "u_k7m2q9", System.getenv("DATABASE_PASSWORD"))) {
            ResultSet r = c.createStatement().executeQuery("select version()");
            r.next();
            System.out.println(r.getString(1));
        }
    }
}

4. Next steps

  • Limit who can connect with the IP allowlist.
  • Learn how to restore to a point in time.
  • Choose a replication mode on high-availability plans.
  • Automate all of this with the API: create an API key under API keys and send it as Authorization: Bearer dbk_… to /api/v1.

More guides

  • Backups and point-in-time restoreHow ElectraDB backs up PostgreSQL continuously, and how to restore a database to any second of the last 7 days, even after deleting it.
  • High availability and replication modesHow ElectraDB keeps PostgreSQL online with a standby in a second site, automatic failover, and sync, write or async replication.
  • Security: TLS, passwords, IP allowlist and encryptionHow ElectraDB secures managed PostgreSQL: verified TLS, one-time passwords, IP allowlists, encrypted backups, API keys and two-factor sign-in.
  • Plans, resizing and storage limitsChoose an ElectraDB PostgreSQL plan, change plans without downtime, and learn what happens when a database reaches its storage limit.
  • When your database is fullA database that reaches its plan's storage becomes read-only. How to free space and get writes working again.
  • Regions and data residencyChoose where your ElectraDB PostgreSQL database lives: EU, US or Asia. Your database, its standby and its backups stay in that region.
  • Frequently asked questionsAnswers about ElectraDB managed PostgreSQL: high availability, backups, point-in-time restore, regions, security, plans and billing.
ElectraDBManaged PostgreSQL in the EU, the US and Asia.99% uptime SLA with service credits · Prices in EUR, excluding VAT · For business customers
ProductPricingSLAStatusSign upLog in
DocsAll guidesQuickstartBackups and restoreHigh availabilitySecurityFAQ
LegalTerms of ServicePrivacy PolicyCookiesData Processing AgreementService Level AgreementSub-processorsLegal notice
ContactSupport: [email protected]Privacy: [email protected]Report abuse: [email protected]Security: [email protected]
© 2026 [Company legal name, e.g. ElectraDB S.L.] · [Registered address, postcode, city, country] · VAT [VAT / tax id, e.g. ESB12345678]No tracking or advertising cookies.