Skip to main content

Connections

Connections are used to authenticate DB requests made by the agent. This is an optional setting and is only required if the DB requires authentication. ToothFairyAI supports the following connection types:

  • MySQL: This is a popular open-source relational database management system.
  • PostgreSQL: This is a powerful, open-source object-relational database system.
  • SQL Server: This is a relational database management system developed by Microsoft.
  • Oracle: This is a powerful object-relational database management system.

Connections can be created and or edited from the following menu: Settings > Connections > Create

`Create new connection.`

Create a connection

Important Security Notice

NEVER use publicly accessible databases with ToothFairyAI connections. Always ensure your database is properly secured behind firewalls, VPNs, or other network security measures. Only connect to databases within your private network infrastructure.

Required Setup

Before creating a connection, you must contact the ToothFairyAI team to ensure your database host is reachable from our systems. This network configuration step is essential for successful connections.

  1. Contact ToothFairyAI Support - Reach out to our team to configure network access to your database host.
  2. Click on the Create button.
  3. Fill in the connection name and description(optional).
  4. Select the Connection type from the dropdown menu (MySQL, PostgreSQL, SQL Server, Oracle).
  5. Fill in Host, Port, Database, Username, Password, and any other required fields based on the connection type selected.
  6. Click on the Save button to create the connection.
  7. Enterprise plans can also include the SSH tunneling details for additional security.
Note

All the secret fields are encrypted and stored securely. You will not be able to see the secret fields once you save the connection. In case you forget the secret fields, you will need to create a new connection.

How DB Functions and Stored Procedures Work

When you create DB Functions that use stored procedures with ToothFairyAI, the system automatically handles the complex setup for you. Here's what happens behind the scenes:

1. Smart Parameter Detection

ToothFairyAI first analyzes your stored procedure to understand what parameters it expects:

  • MySQL: Checks the database's parameter information tables
  • PostgreSQL: Reviews the procedure definition in the system catalog
  • SQL Server: Examines the procedure metadata
  • Oracle: Queries the procedure arguments table

This ensures your parameters are passed in the correct order, even if you provide them differently than expected.

2. Automatic Parameter Mapping

The system maps the parameters you provide to the correct positions required by your stored procedure. If any required parameters are missing, ToothFairyAI will warn you so you can provide them.

3. Database-Optimized Execution

Each database type is handled with its optimal execution method:

  • MySQL: Uses specialized stored procedure calls for better performance
  • PostgreSQL: Executes with standard CALL statements
  • SQL Server: Uses EXEC commands for reliable execution
  • Oracle: Wraps calls in proper BEGIN/END blocks

4. Smart Result Processing

All results are automatically converted to a format that works seamlessly with your applications:

  • Numbers are properly formatted
  • Dates are converted to standard formats
  • Multiple result sets are handled automatically

5. Secure Connection Management

The system safely manages your database connections, ensuring they're properly closed after each operation to maintain security and performance.

Pro Tip

You don't need to worry about the technical details - just provide your stored procedure name and parameters, and ToothFairyAI handles the rest automatically!

Warning

The DB functions are available only for Enterprise plans. Please contact us for more information.