Connection Details
Get your database credentials and connect from any client or framework.
Retrieving Connection Info
From the Dashboard
- Navigate to your database in the Dashboard.
- Click the Connection tab.
- 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 Mode | Description |
|---|---|
prefer | Use SSL if available (default) |
require | Always use SSL |
disable | No SSL |
Troubleshooting
"Connection refused"
- Verify the database status is Active
- Check you're using the correct port (6432 for PostgreSQL via PgBouncer)
- Ensure your IP is not blocked by network policies
"Authentication failed"
- Verify your username and password
- Check that the database user is active
- Try retrieving fresh credentials from the Connection endpoint
Next Steps
- Database Users — Create additional access accounts
- Connection Pooling — Understand PgBouncer configuration