Lookup values in an external datasource
The Lookup values in an external datasource (SqlQueryMapping) mapping is used to execute a parameterized SQL query against an external database using a value from the incoming message. This mapping allows you to enrich the message with data fetched from a database.
Required Attributes
| Attribute | Required | Description |
|---|---|---|
| From | Yes | Field in the message whose value will be used as the SQL parameter. |
| To | Yes | Field where the result of the query will be stored. |
| Precedence | Yes | Determines the order in which this mapping is applied relative to others. |
| Function Type | Yes | Must be "Enrichment/lookup functons" |
| Function | Yes | Needs to be "lookup values in an external datasource" |
| connectionstring | Yes | JDBC connection string to the target database. |
| user | No | Username for database authentication. |
| password | No | Password for database authentication. |
| query | Yes | SQL query with a single ? placeholder for the parameter. |
note
The SQL must contain exactly one ? placeholder, which will be replaced by the value from de from field at runtime.