You can use a message map to enhance an existing message
with data from one or more database tables. Data from the database
can then be used to enrich, route, and transform messages within WebSphere® Message Broker.
In
WebSphere Message Broker,
to connect to a database, you must configure the development environment
and the
WebSphere Message Broker runtime
environment:
- To have visibility of the database resources during the development
phase, you must connect the WebSphere Message
Broker Toolkit to
the development database.
- To enable the deployed map to execute in the run time, you must
create a JDBC provider configurable service that defines the connection
to the runtime database. This database is normally a different database
server from the one you use for development, and the artifacts could
be in a different database schema.
To configure the
WebSphere Message
Broker Toolkit to
connect to a database, you must create a database definition file
in a data design project, and configure a database connection.
- Data design project: A specialized type of project where you store
your database resources.
- Database definition file: A configuration file where you specify
the database physical details such as database type and version, and
a connection.
- Database connection: Configuration that details the database resources,
that is, the schema, the tables, the store procedures, the indexes,
and other resources, that you need access to from within your WebSphere Message Broker project
resources.
To access information stored in a database from resources in a WebSphere Message Broker project,
you must include a reference to the data design project in your application, service, or Message Broker project.
In WebSphere Message Broker,
you can use a message map to access information in a database, and
then use this information to perform transformations on the message
or to enrich a message.
During the design phase, you must complete the following steps
in the
WebSphere Message
Broker Toolkit to
access graphically database information in a message map:
- Add a reference to each database table from where you must retrieve
data.
- Use a Select transform to define how to
use the database information in the message map. The Select transform
has embedded a nested map. You must define the transforms in this
nested map.
- Use a Failure transform
to handle database failures. The Failure transform
has embedded a nested map. You can define the transforms in this nested
map if you wish to provide specialized handling of any database exceptions
that are hit running the generated SQL statements when the map executes.
If you take the default of not adding a Failure transform, WebSphere Message Broker will
handle the error, reporting it to the system log, and then rolling
back the current message transaction.
To configure the WebSphere Message Broker run
time to connect to a database, you must establish a connection with
the database to fulfill the operations that are performed by the Mapping node.
You must define a JDBC provider configurable service.
Use this scenario to learn how to use a Mapping node
to connect to a database, retrieve data from multiple tables, populate
elements in a SOAP message with this information, and handle a database
SQL exception. use this scenario to also learn how to configure the
JDBC provider configurable service.