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.
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.
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:
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.
| Field | Default | What it does |
|---|---|---|
| Auth Config Type | Static | Static names one Authentication on the port. Dynamic resolves it per message from an Auth Resolution Key, for example a promoted property. |
| Auth Config | Required | The SQL Server Connection Authentication that supplies the connection string. |
| Provider | Required | SqlServer. |
| Command Type | Required | Query or StoredProcedure. |
| Timeout (seconds) | 0 | How long the statement may run before it is cancelled. 0 means no limit. |
| Command Text | Required | The SQL text for a Query, or the schema-qualified procedure name for a StoredProcedure. |
| Input Parameters | Empty | One 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 Parameters | Empty | For 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"). |
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’t | Do | |
|---|---|---|
| Command Text | INSERT INTO Orders (Customer) VALUES ('{{Promoted.Order.Customer}}') | INSERT INTO Orders (Customer) VALUES (@Customer) |
| Input Parameters | None | Key Customer, Value {{Promoted.Order.Customer}} |
| Result | SQL Server receives VALUES ('O'Brien') and fails with Unclosed quotation mark. The message is suspended. | O'Brien is stored as it is. |
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.