Skip to main content

Connection Details

Get your database credentials and connect from any client or framework.


Retrieving Connection Info

From the Dashboard

  1. Navigate to your database in the Dashboard.
  2. Click the Connection tab.
  3. Copy the connection string or individual credentials.

Via the API

curl -X GET https://api.lordbase.com/e/v1/developer/databases/{database_id}/connection/ \
-H "Authorization: Bearer lb_pat_your_token"

Response:

{
"host": "api.lordbase.com",
"port": 6432,
"database": "lb_a1b2c3d4e5f6",
"username": "admin_12345678",
"password": "secure-generated-password",
"connection_string": "postgresql://admin_12345678:[email protected]:6432/lb_a1b2c3d4e5f6",
"ssl_mode": "prefer"
}

Connection Strings by Engine

PostgreSQL (via PgBouncer)

postgresql://username:[email protected]:6432/db_name
tip

Always connect through the PgBouncer port (6432) for PostgreSQL. This provides connection pooling and better performance.

Redis

redis://username:[email protected]:6379/0

MongoDB

mongodb://username:[email protected]:27017/db_name

Client Configuration Examples

psql (PostgreSQL CLI)

psql "postgresql://admin_12345678:[email protected]:6432/lb_a1b2c3d4e5f6"

Django

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'lb_a1b2c3d4e5f6',
'USER': 'admin_12345678',
'PASSWORD': 'your-password',
'HOST': 'api.lordbase.com',
'PORT': '6432',
}
}

Prisma

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
DATABASE_URL="postgresql://admin_12345678:[email protected]:6432/lb_a1b2c3d4e5f6"

SQLAlchemy

from sqlalchemy import create_engine

engine = create_engine(
"postgresql://admin_12345678:[email protected]:6432/lb_a1b2c3d4e5f6"
)

SSL Configuration

SSL ModeDescription
preferUse SSL if available (default)
requireAlways use SSL
disableNo SSL

Troubleshooting

"Connection refused"

  1. Verify the database status is Active
  2. Check you're using the correct port (6432 for PostgreSQL via PgBouncer)
  3. Ensure your IP is not blocked by network policies

"Authentication failed"

  1. Verify your username and password
  2. Check that the database user is active
  3. Try retrieving fresh credentials from the Connection endpoint

Next Steps