You can access additional information in a database to enhance
or influence the operation of the message flow, and modify the contents of
a database by adding new information or removing or replacing existing information.
You
can access a database from a message flow from the following nodes:
- Compute
- Database
- DataInsert
- DataDelete
- DataUpdate
- Filter
- Mapping
- Warehouse
For more details of these nodes, and how to configure them in message
flows, see Built-in nodes.
If you
want the actions that the message flow takes against the database to be coordinated
with other actions, configure the message flow to support coordinated transactions.
For information on how to do this, see Configuring coordinated message flows.
To
access a database from a message flow:
- Identify the database that you want to access. This
can be an existing database or a new one created for this purpose.
If you
want to create a new database, follow the instructions given in Creating the databases. These describe how to create a DB2 database for a broker,
but are equally applicable for user databases.
If you want to use a
database other than DB2, refer to the database product documentation for details
on how to do this.
Supported databases defines
the database products that are supported by WebSphere
Business Integration Message Broker.
- Create an ODBC data source to the database if one does not already
exist. Follow the instructions given in Configuring access to databases. These describe how to create a data source for
a broker database, but are equally applicable for user databases.
- Authorize the broker to access the database.
Access
to a user database from within a message flow is controlled by user ID and
password.
If your broker is running
on z/OS, you can use only the broker started-task ID to access user databases,
regardless of the system on which you have created and configured the database.
On distributed systems, you can specify these values:
- When you create the broker.
The mqsicreatebroker command
has two parameters -u DataSourceUserid and -p DataSourcePassword that you can use to identify
the user ID that the broker uses to access its own database. If you specify
these parameters, they are used as the default access control parameters for
user databases that are accessed by message flows.
If you do not specify DataSourceUserid and DataSourcePassword,
the broker uses the values specified for the parameters -i
ServiceUserID and -a ServicePassword (which
identify the user under which the broker runs) as the default values.
- After you have created the broker.
Use the mqsisetdbparms command
to specify a user ID and password pair. This changes the defaults that were
set when you created the broker (described above).
You can create a
user ID and password pair for any database (identified by DSN) that is accessed
by a message flow. You can therefore control access to a database at an individual
level if you choose. This includes databases that you have created and configured
on z/OS that are accessed by brokers on distributed systems.
If the user that created a table in a database is not the user that
the broker is using to access the database, you must specify the user ID that
created the database as the schema name in relevant ESQL statements, unless
you have set up an alias or synonym.
Note: If you access a database from a message flow using
a Compute, Database or Filter node, import the database SQL into the message
flow project or reference another project to which the database SQL has been
imported. Use the Data perspective to create a connection to the appropriate
database, then import it into the message flow project.
For
more information, see Importing database schema files using the Data perspective.The Message Routing sample, the Data Warehouse sample,
the Error Handler sample, and the Airline Reservations sample access
databases from message flows. The Message Routing sample and Data Warehouse
sample use Compute nodes to access the database, the Error Handler uses Database
nodes to access the database, and the Airline Reservations sample uses both
Compute and Database nodes.