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 ServerMYSQL: 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.,
3306for MySQL,1433for MSSQL).
- Type: Choose the type of database you are connecting to.
- 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
Datainput. - 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
- Type:
- 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"\}
- Database connection:
- Result: A new customer record for "Jane Doe" with her email and phone number is added to the
Customerstable in yourCRM_Productiondatabase.
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
- Type:
- 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"\}
- Database connection:
- Result: A new entry is created in the
EventHistorytable of theApplicationLogsdatabase, 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
- Type:
- 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\}
- Database connection:
- 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
Productstable in theInventoryDB.