Ask AI
Skip to main content

Insert into ext. database

Function: Insert into ext. database

This function allows you to add a new record (a row of data) into a table within an external database. It's useful when you need to store information collected in your application directly into a database that is not part of the platform's built-in storage.

Input

  • Database connection: This is a collection of settings that tell your application how to connect to your external database.
    • Type: Choose the type of database you are connecting to.
      • MSSQL: Microsoft SQL Server
      • MYSQL: MySQL Database
    • Server: The address or hostname of your database server (e.g., my-database.example.com).
    • Database: The specific name of the database you want to connect to on the server (e.g., CustomerData).
    • User: The username required to access the database.
    • Password: The password for the specified user.
    • Port: The network port number used for the database connection (e.g., 3306 for MySQL, 1433 for MSSQL).
  • Table: The name of the specific table within your database where you want to insert the new record (e.g., Customers, Products).
  • Data format: This input helps define the structure of the data you intend to insert. While not directly used for the insertion itself, it guides you in providing the correct fields for your Data input.
  • Data: This is the actual record you want to insert. It should be provided as a collection of field names and their corresponding values, matching the columns in your chosen table.

Output

This function does not return any direct output to be used in subsequent steps. Its primary outcome is the successful insertion of the data into the specified external database table.

Execution Flow

Real-Life Examples

Example 1: Adding a New Customer Record

Imagine you have a form in your application where users can sign up. After they submit the form, you want to save their details into an external customer database.

  • Inputs:
    • Database connection:
      • Type: MYSQL
      • Server: customerdb.cloudprovider.com
      • Database: CRM_Production
      • User: app_user
      • Password: secureP@ss123
      • Port: 3306
    • Table: Customers
    • Data format: (A schema defining fields like FirstName, LastName, Email, PhoneNumber)
    • Data: \{"FirstName": "Jane", "LastName": "Doe", "Email": "jane.doe@example.com", "PhoneNumber": "555-123-4567"\}
  • Result: A new customer record for "Jane Doe" with her email and phone number is added to the Customers table in your CRM_Production database.

Example 2: Logging an Application Event

Your application performs various actions, and you want to keep a detailed log of these events in a separate logging database for auditing and analysis.

  • Inputs:
    • Database connection:
      • Type: MSSQL
      • Server: logserver.internal.net
      • Database: ApplicationLogs
      • User: log_writer
      • Password: LogP@ssw0rd
      • Port: 1433
    • Table: EventHistory
    • Data format: (A schema defining fields like Timestamp, EventType, Message, UserID)
    • Data: \{"Timestamp": "2023-10-27 14:00:00", "EventType": "Order Placed", "Message": "User 'john.smith' placed order #1001.", "UserID": "john.smith"\}
  • Result: A new entry is created in the EventHistory table of the ApplicationLogs database, recording that user 'john.smith' placed order #1001 at the specified timestamp.

Example 3: Updating Product Inventory

When a new product is created in your internal system, you want to automatically add it to an external inventory management database.

  • Inputs:
    • Database connection:
      • Type: MYSQL
      • Server: inventory.external.com
      • Database: InventoryDB
      • User: inv_app
      • Password: InvSecure!23
      • Port: 3306
    • Table: Products
    • Data format: (A schema defining fields like ProductID, ProductName, StockQuantity, UnitPrice)
    • Data: \{"ProductID": "PROD-005", "ProductName": "Wireless Mouse", "StockQuantity": 500, "UnitPrice": 25.99\}
  • Result: A new product entry for "Wireless Mouse" with a stock quantity of 500 and a unit price of 25.99 is added to the Products table in the InventoryDB.