WebSphere Enterprise Service Bus, Version 6.2.0 Operating Systems: AIX, HP-UX, i5/OS, Linux, Solaris, Windows


Database Lookup mediation primitive

Use the Database Lookup mediation primitive to modify a message, using information from a database.

Introduction

The Database Lookup mediation primitive can add to, or change, messages. It does this using information from a user-supplied database.

You configure the Database Lookup mediation primitive by specifying the database, database table, primary key column, and database column from which to get information. You must also specify where, in the input message, to find the value that is used as the database key.

The Database Lookup mediation primitive has one input terminal (in), two output terminals (out and keyNotFound), and a fail terminal (fail). The in terminal is wired to accept a message and the other terminals are wired to propagate a message. The out terminal is used if the key is located both in the message and the database. In this case, the information obtained from the database is stored in the message and the updated message is propagated. The keyNotFound terminal is used if the key is found in the message, but not in the database. In this case, the original message is propagated unchanged. If an exception occurs during the processing of the input message, the fail terminal propagates the original message, together with any exception information.

Details

Given a database key, the Database Lookup mediation primitive looks up values in a database and stores them as elements in the message.

The information obtained from the database might need converting before it can be stored in the message; you can specify the information type using the Type property. At run time, if the information obtained from the database cannot be converted to the type expected by the message, an exception occurs.

If a message element already exists in the message, the old value is overwritten with the new value.

Usage

You can use the Database Lookup mediation primitive to ensure information in a message is up-to-date.

You can use the Database Lookup mediation primitive to add information to a message, using a key contained in a message. For example, the key could be an account number.

It is often useful to combine the Database Lookup mediation primitive with other mediation primitives. For example, you might use an XSL Transformation (XSLT) mediation primitive to manipulate data, before or after the Database Lookup is invoked.

Properties

Data source
The JNDI name of the datasource.
Table
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 column.
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.
Column
The name of the database column from which to copy information.
Type
The information type: the only supported 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. 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.
Table 1. Database Lookup mediation primitive properties
Property Valid Values Default
Data source String  
Table String  
Search column String  
Search location String  
Validate input Boolean: true or false false
Column String  
Type String: defining simple XML schema type or an XML schema type that extends a simple XML schema type  
Target location String: an XPath expression describing the location of a message element  

Considerations

Consider the following when using the Database Lookup mediation primitive:

Figure 1. The Database Lookup properties
First, specify where to start from in the database, then specify the precise values that you want to copy to the message.

reference Reference topic

Terms of use | Feedback


Timestamp icon Last updated: 21 June 2010


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.websphere.wesb620.doc/ref/rwesb_DatabaseLookupmediationprimitive.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).