PostgreSQL Datasource - Complete Guide
๐ Connect PostgreSQL Databaseโ
Connection Details ยท SSL Configuration ยท Connection String ยท Testing
๐ Table of Contentsโ
- Overview
- Connection Methods
- Connection Details Configuration
- Connection String Configuration
- SSL Configuration
- Advanced Options
- Testing Connection
- Troubleshooting
- Examples
Overviewโ
Jet Admin provides native PostgreSQL connectivity with full support for:
- โ Standard PostgreSQL connections
- โ SSL/TLS encrypted connections
- โ Connection pooling
- โ Custom connection parameters
- โ Connection testing before saving
- โ Encrypted credential storage
PostgreSQL Version Support: 9.4 and above
Connection Methodsโ
Jet Admin offers two methods to connect to PostgreSQL:
Method 1: Connection Details (Recommended)โ
Enter individual connection parameters (host, port, database, etc.)
Best for:
- Standard database connections
- When you need fine-grained control
- SSL configuration requirements
Method 2: Connection Stringโ
Provide a complete PostgreSQL connection URI
Best for:
- Quick connections
- Copy-pasting from hosting providers
- Heroku, Railway, Supabase deployments
Connection Details Configurationโ
When you select "Connection Details", you'll configure these fields:
Basic Connection Fieldsโ
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
| Connection Name | String | โ Yes | - | Min: 3 chars, Max: 255 | A unique name to identify this datasource in Jet Admin |
| Host | String | โ Yes | - | Valid hostname or IP | PostgreSQL server hostname or IP address |
| Port | Integer | โ No | 5432 | 1 - 65535 | PostgreSQL server port number |
| Database | String | โ Yes | - | Min: 1 char | Name of the database to connect to |
| User | String | โ Yes | - | Min: 1 char | PostgreSQL username for authentication |
| Password | String | โ Yes | - | - | Password for the PostgreSQL user |
Connection Nameโ
Purpose: Identify this datasource within Jet Admin's datasource list.
Best Practices:
- Use descriptive names:
Production-Orders-DBnotDB1 - Include environment:
Dev-Postgres,Staging-DB,Prod-Analytics - Keep it unique across your tenant
Examples:
โ
Good: "Production-Postgres-Main"
โ
Good: "Dev-Database-Orders"
โ Bad: "DB1"
โ Bad: "Test"
Hostโ
Purpose: The PostgreSQL server address.
Accepted Formats:
- Domain name:
db.example.com - Subdomain:
postgres.internal.network - IP address:
192.168.1.100 - localhost:
localhost(for local development) - AWS RDS:
mydb.123456789012.us-east-1.rds.amazonaws.com - Heroku:
ec2-54-123-45-67.compute-1.amazonaws.com - Supabase:
dbabcdefghijklmnop.supabase.co
Important Notes:
- For Docker deployments, use the service name (e.g.,
postgres) - For cloud databases, use the public endpoint provided
- Ensure the server is accessible from Jet Admin's network
Portโ
Purpose: TCP port for PostgreSQL connections.
Default: 5432 (standard PostgreSQL port)
Common Variations:
- Standard PostgreSQL:
5432 - Heroku PostgreSQL: Varies (provided in connection URL)
- Custom installations: Any available port
When to Change:
- Your PostgreSQL server uses a non-standard port
- Multiple PostgreSQL instances on same server
- Cloud provider assigns custom ports
Databaseโ
Purpose: The specific database to connect to within PostgreSQL.
Requirements:
- Must exist on the PostgreSQL server
- User must have CONNECT privilege
- Case-sensitive on some systems
Examples:
โ
myapp_production
โ
analytics_db
โ
orders_database
โ
jetadmin
Userโ
Purpose: PostgreSQL role for authentication.
Best Practices:
- Use dedicated user for Jet Admin (not postgres superuser)
- Grant only required privileges (SELECT, INSERT, UPDATE, DELETE)
- Avoid using superuser accounts in production
Recommended Privileges:
-- Create dedicated user
CREATE ROLE jetadmin WITH LOGIN PASSWORD 'secure_password';
-- Grant database access
GRANT CONNECT ON DATABASE mydb TO jetadmin;
-- Grant schema access
GRANT USAGE ON SCHEMA public TO jetadmin;
-- Grant table privileges
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO jetadmin;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO jetadmin;
Passwordโ
Purpose: Authentication credential for the PostgreSQL user.
Security:
- Stored encrypted in Jet Admin database (AES-256)
- Never displayed in plain text after saving
- Transmitted over encrypted connection (when SSL enabled)
Password Requirements:
- Minimum 8 characters recommended
- Include uppercase, lowercase, numbers, special characters
- Rotate regularly (every 90 days recommended)
SSL Configurationโ
SSL Mode Optionsโ
| SSL Mode | Description | Use Case |
|---|---|---|
| disable | No SSL encryption | Local development only |
| allow | Try non-SSL, then SSL | Legacy servers |
| prefer | Try SSL, then non-SSL | Default - Recommended |
| require | Require SSL (no verification) | Production with self-signed certs |
| verify-ca | Require SSL + verify CA | Production with trusted CA |
| verify-full | Require SSL + verify CA + verify host | Most Secure - Production |
SSL Mode Detailsโ
disableโ
Encryption: โ None
Certificate Verification: โ None
Security Level: โ ๏ธ None
Use Only For: Local development with localhost PostgreSQL
prefer (Default)โ
Encryption: โ
Preferred
Certificate Verification: โ ๏ธ Optional
Security Level: โ
Good
Use For: Most production deployments
requireโ
Encryption: โ
Required
Certificate Verification: โ None
Security Level: โ
Good
Use For: Production with self-signed certificates
verify-caโ
Encryption: โ
Required
Certificate Verification: โ
CA verified
Security Level: โ
โ
Better
Use For: Production with certificates from trusted CA
verify-fullโ
Encryption: โ
Required
Certificate Verification: โ
CA + Host verified
Security Level: โ
โ
โ
Best
Use For: High-security production environments
Advanced Optionsโ
Additional Connection Parametersโ
Jet Admin supports any PostgreSQL connection parameter via additionalOptions:
| Parameter | Type | Description | Example |
|---|---|---|---|
| connectTimeout | Integer | Connection timeout in seconds | 10 |
| applicationName | String | Application identifier sent to server | JetAdmin-App |
| searchPath | String | Default schema search path | public,analytics |
| sslcert | String | Path to client SSL certificate | /path/to/cert.pem |
| sslkey | String | Path to client SSL key | /path/to/key.pem |
| sslrootcert | String | Path to root CA certificate | /path/to/ca.pem |
| options | String | Command-line options for PostgreSQL | -c timezone=UTC |
connectTimeoutโ
Purpose: Maximum time to wait for connection establishment.
Type: Integer (seconds)
Default: 30 seconds
When to Adjust:
- Slow networks: Increase to
60 - Fast local network: Decrease to
5 - Cloud databases with firewalls:
15-30
Example:
{
"additionalOptions": {
"connectTimeout": 15
}
}
applicationNameโ
Purpose: Identify the application to PostgreSQL.
Benefits:
- Track connections in
pg_stat_activity - Filter logs by application
- Set application-specific configurations
Example:
{
"additionalOptions": {
"applicationName": "JetAdmin-Dashboard"
}
}
Query Running Applications:
SELECT application_name, count(*)
FROM pg_stat_activity
GROUP BY application_name;
searchPathโ
Purpose: Default schema search order.
Use Case: When using multiple schemas
Example:
{
"additionalOptions": {
"options": "-c search_path=analytics,public"
}
}
Connection String Configurationโ
Connection String Formatโ
When you select "Connection String", provide a complete PostgreSQL URI:
postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1¶m2=value2]
Complete Exampleโ
postgresql://myuser:mypassword@db.example.com:5432/mydb?sslmode=require&application_name=JetAdmin
Connection String Componentsโ
| Component | Format | Required | Example |
|---|---|---|---|
| Protocol | postgresql:// or postgres:// | โ Yes | postgresql:// |
| User | username | โ Yes | myuser |
| Password | :password | โ Yes | :mypassword |
| Host | @hostname | โ Yes | @db.example.com |
| Port | :port | โ No (default: 5432) | :5432 |
| Database | /dbname | โ Yes | /mydb |
| Parameters | ?key=value&key2=value2 | โ No | ?sslmode=require |
Special Characters in Passwordโ
URL-encode special characters in passwords:
| Character | URL Encoding |
|---|---|
@ | %40 |
: | %3A |
/ | %2F |
? | %3F |
# | %23 |
& | %26 |
= | %3D |
+ | %2B |
% | %25 |
Example:
Password: my@pass:word
Encoded: my%40pass%3Aword
Connection String: postgresql://user:my%40pass%3Aword@host:5432/db
Common Connection String Examplesโ
Local Developmentโ
postgresql://postgres:password@localhost:5432/mydb
Heroku PostgreSQLโ
postgresql://username:password@ec2-54-123-45-67.compute-1.amazonaws.com:5432/dbname?sslmode=require
AWS RDSโ
postgresql://admin:password@mydb.123456789012.us-east-1.rds.amazonaws.com:5432/production?sslmode=require
Supabaseโ
postgresql://postgres:password@dbabcdefghijklmnop.supabase.co:5432/postgres?sslmode=require
Railwayโ
postgresql://user:password@railway.railway.internal:5432/railway?sslmode=require
With SSL Verificationโ
postgresql://user:pass@host:5432/db?sslmode=verify-full&sslrootcert=/path/to/ca.pem
With Application Nameโ
postgresql://user:pass@host:5432/db?application_name=JetAdmin-Dashboard
With Search Pathโ
postgresql://user:pass@host:5432/db?options=-c%20search_path%3Danalytics,public
Testing Connectionโ
How to Testโ
- Configure your PostgreSQL connection (details or string)
- Click "Test Connection" button
- Wait for connection attempt (1-5 seconds)
- Review the result
Test Resultsโ
โ Successโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Connection Successful! โ
โ โ
โ Connected to: postgresql://host:5432 โ
โ Database: mydb โ
โ User: myuser โ
โ SSL: enabled (verify-full) โ
โ Response Time: 45ms โ
โ PostgreSQL Version: 14.5 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Failureโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Connection Failed โ
โ โ
โ Error: ECONNREFUSED โ
โ Message: Connection refused โ
โ Host: db.example.com:5432 โ
โ โ
โ Troubleshooting: โ
โ โข Check if PostgreSQL is running โ
โ โข Verify host and port โ
โ โข Check firewall rules โ
โ โข Ensure network connectivity โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Common Test Errorsโ
| Error | Cause | Solution |
|---|---|---|
ECONNREFUSED | PostgreSQL not running or wrong port | Start PostgreSQL, verify port |
ETIMEDOUT | Network unreachable or firewall | Check network, firewall rules |
ER_ACCESS_DENIED | Wrong username or password | Verify credentials |
FATAL: database does not exist | Database name incorrect | Check database exists |
no pg_hba.conf entry | Host not allowed in pg_hba.conf | Update pg_hba.conf |
SSL required | Server requires SSL | Enable SSL mode |
certificate verify failed | Invalid SSL certificate | Use verify-ca or verify-full |
Troubleshootingโ
Connection Issuesโ
"Connection Refused"โ
Symptoms:
- Test connection fails immediately
- Error:
ECONNREFUSED
Solutions:
-
Verify PostgreSQL is running:
# Linux/Mac
sudo systemctl status postgresql
# Windows
Get-Service -Name postgresql -
Check PostgreSQL is listening:
netstat -an | grep 5432 -
Verify host and port are correct
-
Check firewall allows connections:
# Linux
sudo ufw allow 5432/tcp
# AWS Security Group
# Add inbound rule: TCP 5432 from Jet Admin IP
"Connection Timeout"โ
Symptoms:
- Test hangs for 30+ seconds
- Error:
ETIMEDOUT
Solutions:
-
Check network connectivity:
ping db.example.com
telnet db.example.com 5432 -
Verify DNS resolution:
nslookup db.example.com -
Check for network proxies
-
Increase connection timeout in advanced options
"Access Denied"โ
Symptoms:
- Connection established but authentication fails
- Error:
FATAL: password authentication failed
Solutions:
-
Verify username and password are correct
-
Check user exists in PostgreSQL:
\du -
Verify user has CONNECT privilege:
GRANT CONNECT ON DATABASE mydb TO myuser; -
Check pg_hba.conf allows your connection:
# Allow from specific IP
host mydb myuser 192.168.1.0/24 md5
# Allow from any IP (not recommended for production)
host mydb myuser 0.0.0.0/0 md5
SSL Issuesโ
"SSL Required"โ
Symptoms:
- Error:
FATAL: no pg_hba.conf entry for host, SSL off
Solutions:
- Enable SSL in connection configuration
- Set SSL mode to
requireor higher - Update pg_hba.conf to require SSL:
hostssl mydb myuser 0.0.0.0/0 md5
"Certificate Verification Failed"โ
Solutions:
-
For self-signed certificates, use
sslmode=require(not verify-full) -
For production, install CA certificate:
{
"additionalOptions": {
"sslrootcert": "/path/to/ca-cert.pem"
}
} -
Verify certificate chain is complete
Performance Issuesโ
Slow Connectionsโ
Solutions:
-
Increase connection pool size in PostgreSQL:
SHOW max_connections;
-- Default: 100
-- Increase if needed: ALTER SYSTEM SET max_connections = 200; -
Add connection pooling (PgBouncer)
-
Use connection pooling in Jet Admin (coming soon)
-
Optimize network latency
Examplesโ
Example 1: Local Developmentโ
{
"connectionOption": "connectionDetails",
"connectionDetails": {
"connectionName": "Local-Dev-Postgres",
"host": "localhost",
"port": 5432,
"database": "myapp_dev",
"user": "postgres",
"password": "password",
"sslMode": "disable"
}
}
Example 2: Heroku Productionโ
{
"connectionOption": "connectionString",
"connectionString": "postgresql://username:password@ec2-54-123-45-67.compute-1.amazonaws.com:5432/dbname?sslmode=require"
}
Example 3: AWS RDS with SSLโ
{
"connectionOption": "connectionDetails",
"connectionDetails": {
"connectionName": "AWS-RDS-Production",
"host": "mydb.123456789012.us-east-1.rds.amazonaws.com",
"port": 5432,
"database": "production",
"user": "jetadmin",
"password": "secure-password-here",
"sslMode": "verify-full",
"additionalOptions": {
"connectTimeout": 15,
"applicationName": "JetAdmin-Production"
}
}
}
Example 4: Supabaseโ
{
"connectionOption": "connectionString",
"connectionString": "postgresql://postgres:password@dbabcdefghijklmnop.supabase.co:5432/postgres?sslmode=require&application_name=JetAdmin"
}
Example 5: Multiple Schemasโ
{
"connectionOption": "connectionDetails",
"connectionDetails": {
"connectionName": "Analytics-DB",
"host": "analytics.internal",
"port": 5432,
"database": "analytics_prod",
"user": "analyst",
"password": "secure-pass",
"sslMode": "require",
"additionalOptions": {
"options": "-c search_path=analytics,public"
}
}
}
Next Stepsโ
- Create Data Queries - Build queries on this datasource
- REST API Datasource - Connect to REST APIs
- Workflow Integration - Use in workflows
- Troubleshooting - Common issues