Connecting to CockroachDB on Layerbase Cloud

CockroachDB speaks the PostgreSQL wire protocol, so most Postgres clients can connect with CockroachDB-specific SQL caveats.

Best for: Distributed SQL experiments, PostgreSQL-compatible apps, and workloads that need CockroachDB semantics.

1

Open your database in the dashboard

Go to /cloud, click the database you just created, and the connection panel shows the host, port, username, password, and a ready-to-paste connection string for the engine.

Use the generated SQL connection string from Quick Connect.

2

TLS is required, on by default

Append ?sslmode=require to the connection string.

PostgreSQL-compatible wire protocol on port 5432

3

Use any standard client

CockroachDB works with the normal client family for that engine. Start with the dashboard snippet, then move the same URL and credentials into your app environment.

If your client has separate direct, pooled, TLS, or HTTP options, prefer the exact variant shown in Quick Connect.

bashCockroachDB
cockroach sql --url "postgresql://layerbase:password@your-host.cloud.layerbase.dev:5432/app?sslmode=require"

CockroachDB notes

  • If CockroachDB is not enabled for Cloud creation, run it locally with SpinDB while cloud support is gated.
  • PostgreSQL clients connect, but SQL behavior is CockroachDB-specific.