Share via


Connection strings

Important

Lakebase Autoscaling is in Beta in the following regions: eastus2, westeurope, westus.

Lakebase Autoscaling is the latest version of Lakebase with autoscaling compute, scale-to-zero, branching, and instant restore. For feature comparison with Lakebase Provisioned, see choosing between versions.

A Lakebase connection string includes the role, hostname, and database name. For native Postgres password authentication, the connection string also includes the password. For OAuth authentication, you provide an OAuth token in place of a password. See Obtain an OAuth token.

Connection string format

OAuth authentication:

postgresql://your-email@example.com@ep-abc-123.databricks.com/databricks_postgres?sslmode=require
             ^                      ^                         ^
       role -|                      |- hostname               |- database

Native Postgres password authentication:

postgresql://role_name:password@ep-abc-123.databricks.com/databricks_postgres?sslmode=require
             ^         ^        ^                         ^
       role -|         |        |- hostname               |- database
                       |
                       |- password

Note

The hostname includes the ID of the compute endpoint, which has an ep- prefix (for example, ep-abc-123). This identifies the specific compute that serves your database.

Connection string components

You can configure Postgres either with separate environment variables or with a single DATABASE_URL, depending on what your application or framework expects.

To use individual components:

PGHOST=ep-abc-123.databricks.com
PGDATABASE=databricks_postgres
PGUSER=role_name
PGPASSWORD=your-password or token
PGPORT=5432

To use a single environment variable:

DATABASE_URL="postgresql://role_name:password@ep-abc-123.databricks.com/databricks_postgres?sslmode=require"

Connection security

  • SSL/TLS encryption: Lakebase Autoscaling requires that all connections use SSL/TLS encryption. The sslmode=require parameter enforces this requirement. All connection strings provided in the Lakebase App include this parameter by default.
  • Private connectivity: Lakebase Autoscaling supports connectivity through Azure Databricks Front-end PrivateLink.

Port

Lakebase uses the default Postgres port, 5432.

Network configuration

When connecting to your Lakebase database, consider these network requirements:

  • Classic compute connections: To connect Classic compute to PostgreSQL, open TCP port 5432 in your network security group to your workspace IP ACL address or range.

Next steps