Direct PostgreSQL Connection
Connect ForceCnx to any PostgreSQL database using standard host/port credentials.
Prerequisites
- A PostgreSQL database (version 12 or later recommended)
- A database user with
SELECTpermission on the tables you want to expose - Network access from ForceCnx to your database host and port
Create a Connection
Open the New Connection form
From your ForceCnx Dashboard, click + New Connection and select the Direct tab.
Enter connection details
Fill in your database connection parameters:
| Field | Description | Example |
|---|---|---|
Host | Database server hostname or IP | db.example.com |
Port | PostgreSQL port | 5432 |
Database | Database name | myapp |
Username | Database user | forcecnx_reader |
Password | Database password | — |
SSL Mode | SSL connection mode | require |
Test and save
Click Create Connection. ForceCnx will test the connection and automatically introspect your database schema to discover available tables.
Network Configuration
Your database must be reachable from ForceCnx over the internet. If your database is behind a firewall, you'll need to allow inbound connections on your PostgreSQL port.
Security: We recommend creating a dedicated read-only database user for ForceCnx rather than using your application's credentials. Grant only SELECT on the specific tables you need.
Recommended Database User Setup
-- Create a read-only user for ForceCnx
CREATE USER forcecnx_reader WITH PASSWORD 'your-secure-password';
-- Grant access to specific tables
GRANT USAGE ON SCHEMA public TO forcecnx_reader;
GRANT SELECT ON TABLE customers, orders, products TO forcecnx_reader;
SSL Modes
ForceCnx supports all standard PostgreSQL SSL modes:
| Mode | Description |
|---|---|
disable | No SSL (not recommended for production) |
require | SSL required, no certificate verification |
verify-ca | SSL required, verify server certificate CA |
verify-full | SSL required, verify CA and hostname |
Tip: For most cloud-hosted databases, require is sufficient. Use verify-full for maximum security in production environments.
Verify Connection
After creating the connection, ForceCnx automatically runs schema introspection. You'll see your tables listed on the connection detail page. If the connection fails, check:
- Your database host is reachable from the public internet
- The port is not blocked by a firewall
- The username and password are correct
- The SSL mode matches your database's SSL configuration
Next Steps
Once connected, follow the Getting Started guide to map entities, configure field mappings, and set up Salesforce Connect.