Accessing databases from message flows

Create and configure message flows to access databases.

Before you begin

Complete the following tasks:
Read the following concept topic:
Check which databases are supported on which platform, and if any restrictions apply:

About this task

You can access a database from a message flow in two ways:
  • You can design a message flow that responds to events generated by the database.
  • After a flow has already started, you can access the database to read or update information in it. Information from the database can be used to enhance or influence the operation of the message flow.

You can access a database from a message flow by using the following nodes:

  • Compute
  • Database
  • DatabaseInput
  • DatabaseRetrieve
  • DatabaseRoute
  • Filter
  • JavaCompute
  • Mapping

For more details about 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 global coordination of transactions. For information about how to complete this task, see Configuring transactionality for message flows.

To access a database from a message flow:

Procedure

  1. Identify the database that you want to access.
    You can access an existing database, or create a new database for this purpose. See Data sources on z/OS for more information about what to call a z/OS® database.

    Create the database you want, or ask your database administrator to create it for you. If you are using IBM DB2® or Oracle databases, some of the samples programs include basic instructions for creating databases, which you can use as a guide.

  2. Define a connection to the data source name (DSN) to enable a connection to the database, if one does not exist:
    • Define a JDBC connection if you want to interact with a database directly from a Java™ application, or from a Mapping node. You can code Java in both a JavaCompute node and in a Java user-defined node.

      For more information, see Enabling JDBC connections to the databases.

    • Define an ODBC connection if you want to interact with a database in a node that supports ESQL, including a JavaCompute node in which you use the MbSQLStatement interface.

      For more information, see Enabling ODBC connections to the databases.

  3. Authorize the integration node to access the database.

    Access to a database from within a message flow is controlled by user ID and password.

    • Linux platformUNIX platformUse the mqsisetdbparms command to specify a user ID and password for a specific database, or to set up a default user ID and password.
    • Windows platformUse the mqsisetdbparms command to specify a user ID and password for a specific database, or to set up a default user ID and password. If Windows integrated authentication is being used for SQL Server database access, then the service user ID under which the broker process runs are used by Windows to access the SQL Server database. That is, it ignores any user ID and password credentials that were set using the mqsisetdbparms command.
    • z/OS platformUse the BIPSDBP JCL in the customization data set <hlq>.SBIPPROC to customize the mqsisetdbparms command to specify a user ID and password for a specific database, or to set up a default user ID and password.
    • To check existing accesses, use the mqsireportdbparms command.

Results

Note: You can also access a database from a message flow by using the Database Service. For more information, see Using a Database Service in a message flow.