Accessing databases from message flows

You can create and configure message flows to access user databases.

Before you start:

To complete this task, you must have completed the following tasks:

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:

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:

  1. 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 (for distributed systems) or Creating the broker database. 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.

  2. Create an ODBC connection to the database if one does not already exist. Follow the instructions given in Connecting to the databases. These describe how to create a connection for a broker database, but are equally applicable for user databases.
  3. 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:

    1. 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.

    2. 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.

Related concepts
Message flows

Related tasks
Creating the databases
Connecting to the databases
Creating the broker database
Configuring coordinated message flows
Configuring databases for coordinated message flows
Configuring WebSphere MQ and RRS for coordinated message flows
Editing configurable properties

Related reference
Supported databases
mqsicreatebroker command
mqsisetdbparms command
Built-in nodes
User database connections
User database DBCS restrictions