📧 The Scenario
Your CEO sends an email: "I need a report on all customers who haven't placed an order in the last 90 days. Which ones have the highest lifetime value? We need to reach out before we lose them."
Traditionally, this means filing a request with your data team, waiting days for a custom query, and getting back a spreadsheet you still need to interpret. But what if anyone on your team could simply ask the question in plain English and get the answer instantly, with full security controls in place?
That's exactly what DreamFactory enables. Connect any AI agent to your enterprise database, and your team can start asking questions in natural language. No SQL, no code, no waiting.
🎯 What You'll Learn
By the end of this module, you'll understand how to:
- Connect any AI agent (ChatGPT, Claude, Cursor, or others) to your enterprise database through DreamFactory
- Ask natural language questions about your data and get instant answers
- Progressively refine results through conversational follow-ups
- Keep every query governed by DreamFactory's built-in RBAC and audit logging
The key insight: the AI never touches your database directly. DreamFactory's AI Data Gateway sits between your AI agent and your data, enforcing role-based access controls, rate limiting, and full audit logging on every single query.
🎬 Watch the Demo
DreamFactory CTO Kevin McGahey walks through the entire setup, from creating the connection to asking real questions about a live sales database, in under 5 minutes.
🏗️ How It Works
DreamFactory acts as your AI Data Gateway, a secure, self-hosted bridge between your AI agent and your data sources, including databases and file storage services (S3, Azure Blob, SFTP). Here's the architecture:
Security Is Built In, Not Bolted On
Unlike direct database connections, DreamFactory ensures the AI can only access what you've explicitly permitted. Role-based access controls determine which tables, columns, and operations are available. Every query is logged in the audit trail.
🔧 Setup in 5 Minutes
Getting started is remarkably simple. Here's the high-level flow:
Create a Database Service in DreamFactory
Connect DreamFactory to your existing database. Point it at your SQL Server, MySQL, PostgreSQL, or any supported database. DreamFactory auto-generates secure API endpoints for your tables. You can also connect file storage services like S3, Azure Blob, or SFTP to give your AI agent access to documents and files.
Create a Service for Your AI Agent
In the DreamFactory admin panel, create a new service that your AI agent will connect through. Give it a name (e.g., "Sales Data AI"), select which database it can access, and configure permissions.
Connect Your AI Agent
Copy the connection endpoint from DreamFactory and add it to your AI agent's settings. DreamFactory supports OAuth authentication, so your AI agent connects securely without exposing database credentials.
Start Asking Questions
Open your AI agent and ask questions in plain English: "Show me all customers who haven't ordered in 90 days." The AI translates your question into a query, DreamFactory validates and executes it, and you get your answer.
📊 Real Results from the Demo
In the video demo, CTO Kevin McGahey demonstrates progressive refinement against a live sales database:
The power is in the conversational follow-ups. Start broad, then narrow down: "Which of those have lifetime value over $500K?" then "Tell me more about Apex Financial." Each follow-up drills deeper, all through natural language.
💡 Who Uses This?
This pattern works for anyone who needs answers from data but doesn't write SQL:
Sales Leaders
Pipeline analysis, customer churn, revenue trends
Executives
Ad-hoc reports without waiting for the data team
Marketing Teams
Campaign performance, segmentation, customer insights
Operations
Inventory queries, fulfillment status, vendor analysis
Finance
Spend analysis, variance reports, budget tracking
Compliance
Audit queries with full access logging
🔒 Security First
Every interaction between your AI agent and your database is governed by DreamFactory's enterprise security layer:
- Role-Based Access Control (RBAC): Define exactly which tables, columns, and operations each AI agent can access
- Full Audit Logging: Every query is recorded with who asked, what was accessed, and when
- Rate Limiting: Prevent runaway queries and control resource consumption
- No Direct Database Access: The AI agent never sees database credentials or connects directly
- OAuth Authentication: Secure, token-based authentication for all AI agent connections
Compliance Ready
The audit trail and access controls make this approach compatible with HIPAA, GDPR, SOC 2, and other compliance frameworks. Your security team gets visibility into exactly how AI is interacting with your data.
🚀 Next Steps
- Watch the full CTO demo to see the setup and querying in action
- Explore Module 02 to learn how to set up DreamFactory's MCP Server for AI tool discovery
- Official MCP Server documentation for the latest connection and configuration details
- Book an architecture session to try this with your own database
See Also
Give Claude Access to Your Database and Start a Conversation with Your Data. Connect Claude to your enterprise data for real-time analytics, trend analysis, and root cause exploration through natural language.
Ready to implement? Get the complete step-by-step guide:
Full Step-by-Step Documentation ~15 min