Skip to content
iQBus HomeDocumentationBlogContact
Updated November 14, 2026
Adapters/SQL adapter
Adapter

SQL adapter

A send-side adapter that runs a SQL query or a stored procedure. In two-way mode the result set is republished to the bus as a payload message.

ADAPTER · SEND SQL Runs a query or a stored procedure against a SQL database DIRECTION ↑ Send MODES One-way · Two-way AUTHENTICATION SQL Authentication PORT Send port RESPONSE Payload

The SQL adapter takes a message off the bus and uses it to issue a database operation, the shape of which is configured on the send port. The SQL Authentication paired with the adapter carries the connection string and credentials.

Two operation shapes are supported. The choice is the Command Type on the send port.

Query SQL TEXT INSERT INTO Orders VALUES (@OrderNo, @Total) INPUT PARAMETERS OrderNo ← {{Promoted.Order.No}} Total ← {{Promoted.Order.Total}} SELECT / INSERT / UPDATE / DELETE one or more statements not atomic: each statement commits on its own StoredProcedure NAMED CALL dbo.SubmitOrder INPUT PARAMETERS OrderId ← {{Promoted.Order.Id}} OUTPUT PARAMETERS NewId Input and output parameters outputs read with .GetValue("NewId") use when the database owns the logic
i
A multi-statement Query is not a transaction. Each statement commits on its own, so if a later statement fails, the earlier writes stay. When several writes must succeed or fail together, put them in a stored procedure that manages its own transaction.

In two-way mode the result set is materialised, wrapped, and republished to the bus as a payload message. The format of that payload is decided by the SELECT, not the adapter: a plain SELECT with no FOR clause returns JSON, a SELECT that ends in FOR XML returns XML, and FOR JSON returns JSON explicitly. The diagram below shows the XML envelope a FOR XML query produces:

RESULT SET id | total | status 7831 | 124.50 | New 7832 | 89.00 | New 7833 | 240.00 | New columns × rows wrap BUS MESSAGE MT: SqlCallerResult <Result> <Row> <id>7831</id> <total>124.50</total> <status>New</status> </Row> <!-- … more rows --> </Result> publish Bus picked up by any subscriber downstream port
Match the map to what the SELECT emits. The result format follows the query, not the adapter: a plain SELECT returns JSON, and only a FOR XML clause makes it XML. If a downstream map expects XML but the query returned JSON (or the reverse), the map matches nothing and republishes an empty document. Decide the format in the SELECT, then give the map a source whose format agrees with it.

One-way mode runs the statement and discards the result. The runtime checks the statement's success or failure but does not republish anything.

The SQL adapter pairs with a SQL Authentication built on the SQL Server Connection Definition; its Database Config carries one field, the Connection String, credentials included. SQL Server is the supported engine today; further engines arrive as Definitions of their own. The connection string uses one of two identities: SQL authentication (User ID and Password) or the deployment’s managed identity (Authentication=Active Directory Managed Identity), granted access on the database. The connection is always encrypted. The connection is opened from a pool maintained per Authentication object; the adapter does not own the connection lifecycle.

The dialog, in order
FieldDefaultWhat it does
Auth Config TypeStaticStatic names one Authentication on the port. Dynamic resolves it per message from an Auth Resolution Key, for example a promoted property.
Auth ConfigRequiredThe SQL Server Connection Authentication that supplies the connection string.
ProviderRequiredSqlServer.
Command TypeRequiredQuery or StoredProcedure.
Timeout (seconds)0How long the statement may run before it is cancelled. 0 means no limit.
Command TextRequiredThe SQL text for a Query, or the schema-qualified procedure name for a StoredProcedure.
Input ParametersEmptyOne row per parameter. Key is the parameter name, typed without @; in a Query, write it as @Key in Command Text where the value goes. Value is its value. Enter just the value: the system decides whether it needs quotes, and NULL is entered as NULL. The value can be a {{…}} binding to a promoted property, a variable or a constant. Body extractions are not evaluated here; promote the value on the message type or capture it into a variable first.
Output ParametersEmptyFor a StoredProcedure: the name of each output parameter, without @. The parameter must exist under the same name on the procedure. Read the value in a variable assignment as {{Config.SQLCaller.Output}}.GetValue("Name").
Passing a value from the message

Put every value that comes from the message in Input Parameters, never inside Command Text. A {{…}} binding written inside Command Text is pasted into the SQL exactly as it arrives, so a value with an apostrophe breaks the statement. An Input Parameter is sent to SQL Server separately from the SQL, so the value arrives intact.

Example: store the customer name O'Brien from the message.

Don’tDo
Command TextINSERT INTO Orders (Customer) VALUES ('{{Promoted.Order.Customer}}')INSERT INTO Orders (Customer) VALUES (@Customer)
Input ParametersNoneKey Customer, Value {{Promoted.Order.Customer}}
ResultSQL Server receives VALUES ('O'Brien') and fails with Unclosed quotation mark. The message is suspended.O'Brien is stored as it is.
Where the @ goes. Type the Key without @. The @ appears only in Command Text, at the spot where the value goes.

That is the SQL adapter

Send-side database access. Pick Query or StoredProcedure, bind the parameters, and the result, in two-way, rides back onto the bus as a payload message. Back to Adapters.