Introduction :
Database Lookuo Mediation primitive allows us to get the values from existing
database by using key element and then update the message with values obtained
from selected fields.
Terminals : Database
lookup primitive have 1 input terminal, 2 output terminals, 1fail terminal.
Input terminal :
which accepts the smo message which contains the key element.
Output Terminals :
Out terminal : This propagates
when the database lookup successful. The updated message is propagated from this
terminal.
KeyNotFound: Database record not found with the specified
key element, the unchanged message is propagated from this terminal.
Fail Terminal : Which propegate the original message along with fail information in context
NOTE : Database Lookup primitive does not modify the message body
structure, it modifies the message body contents.
Database Lookup mediation primitive properties :
Data Source : The JNDI name of the datasource.
Table : Need to give fully qualified name. The name of the database table, including the schema name; for example, myschema.mytable.
Search Column : The name of the database's primary key column. The specified Search column must contain a unique value; multi-column database keys are not supported. In addition, the unique value must be of the same element type as the value located in the message using the Search location.
Search Location : Where, in the input message, to find the database key. Specified as an XPath 1.0 expression; the value returned from the XPath expression is used as the key into the database.
Validate Input : If you select the check box, the input message is validated before the mediation is performed.
Data Elements :
Column : The name of the database column from which to copy information. The valid type is String.
Type : The information type: the only supported String types are a simple XML schema type, or an XML schema type that extends a simple XML schema type. At run time, the value obtained from the database is converted to the type defined by the Type property.
Java primitive types
or string are supported only for compatibility with old mediation
flows.
Target Location : Where, in
the message, to store the information obtained from the database.
The valid type is String. Specified as an XPath 1.0 expression describing
the location of a message element. The XPath expression must evaluate
to a single element in the message.
Considerations : Consider the following when using the Database Lookup mediation
primitive:
- You must set up a database, datasource and any server authentication settings for the Database Lookup mediation primitive to use. You can do this using the runtime administrative console.
- The list of supported databases is provided on the systems requirements Web page for the runtime product.
- The Database Lookup mediation primitive can read only from one table.
- You can route a message to the same location whether or not the key is found in the database. To do this you wire both the out terminal and the keyNotFound terminal to the same output location.
- You can able to get single record by unique key element.