Querying a Database

The Query Database task performs a SQL SELECT statement on a database.

The task can specify three types of records:

  • One or more tables in the FROM clause of the SELECT statement
  • One or more columns to return in the SELECT list
  • One or more conditions in the WHERE

You also have the option to specify the maximum number of rows to return.

The Query Database task can be used to look up data in a database table to enrich the data available in a mediation flow.

These are two usage scenarios:

  • Store service names and namespaces for dynamically bound service references in a database table. You can then update the database table when a new service becomes available, and the mediation flow does not need to be changed to obtain the information about the new service.
  • Use a database query to add information to an incoming request. For example, an incoming request may specify a US postal zip code, and a database query can be used to look up the city and state to add this information to the request.