Prerequisites
Connection Methods
Choose the connection method that best fits your security requirements and infrastructure setup.
Database Connection Form
Connect directly using your database credentials with SSL encryption.
Connection String
Use a PostgreSQL connection string with SSL encryption.
SSH Tunnel
Connect through an SSH tunnel for maximum security.
Connection Guide
Step 1: Access PostgreSQL Integration
Navigate to Integrations in Datapad and select PostgreSQL:
Step 2: Fill Connection String
Enter your PostgreSQL database connection string:
Required Fields:
- Connection Name
- Connection String
- Database Schema
Step 3: Fill Connection Details
Enter your PostgreSQL database connection details:
Required Fields:
- Database Host
- Port (default: 5432)
- Database Name
- Username
- Password
- SSL Mode
Create Read-Only User (Recommended)
For security, create a dedicated user with read-only permissions:
-- Create a new user for Datapad
CREATE USER datapad_readonly WITH PASSWORD 'secure_password';
-- Grant connect permission to the database
GRANT CONNECT ON DATABASE your_database TO datapad_readonly;
-- Connect to your database and grant schema usage
\c your_database;
GRANT USAGE ON SCHEMA public TO datapad_readonly;
-- Grant select permissions on all tables
GRANT SELECT ON ALL TABLES IN SCHEMA public TO datapad_readonly;
-- Grant select permissions on future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO datapad_readonly;
Example Queries
Here are some example questions you can ask once your PostgreSQL data is connected:
💬 Natural Language Tips
Behind the Scenes
Datapad automatically converts your natural language questions into optimized PostgreSQL queries. You can always view the generated SQL to learn and verify the results, including PostgreSQL-specific features like JSONB queries and advanced analytics functions.
Troubleshooting
Connection timeout
If the connection times out:
- Check firewall settings and whitelist Datapad IPs
- Verify the host and port are correct
- Ensure PostgreSQL is accepting connections
- Test connectivity from your network
Authentication failed
If authentication fails:
- Verify username and password are correct
- Check if the user has access to the database
- Ensure user can connect from external hosts
- Try connecting with the same credentials using psql client
SSL connection issues
If SSL connection fails:
- Verify SSL is enabled on your PostgreSQL server
- Check if you have valid SSL certificates
- Try different SSL modes (require, prefer, disable)
- Contact support for help with certificate issues