220 Preparing for DB2 Near-Realtime Business Intelligence
Figure D-2 Results of enable_MQFunctions command
You should find that a default MQM named “DB2MQ_DEFAULT_MQM” has been
created and started.
Note: As a result of running enable_MQFunctions, a default MQ environment will
be established. The MQ queue manager
DB2MQ_DEFAULT_MQM and the
default queue
DB2MQ_DEFAULT_Q will be created. The files amt.xml,
amthost.xml,
and amt.dtd will be created if they do not already exist in the
directory pointed to by
AMT_DATA_PATH. If an amthost.xml file does exist, and
does not contain a definition for connectionDB2MQ, then a line will be added to
the file with the appropriate information. A copy of the original file will be saved as
DB2MQSAVE.amthost.xml.
D.4 Create DB2 view over the MQ queue
Creating a DB2 view (Queue View) over an MQ queue is very useful capability,
especially when you are new to MQSeries. It lets you treat the MQ queue just like
a DB2 table. This means you can use SQL statements to access the queue data
just as you would with a DB2 table.
You can develop a Queue View by using the DB2 Development Center.
Figure D-3 on page 221 shows the first step. It enables you to select a UDF or
MQ.
Appendix D. WebSphere MQ and DB2 MQ Listener 221
Figure D-3 Select MQSeries as the UDF type
The next step is to select the type of UDF functions you want the development
center to create. Figure D-4 on page 222 depicts that we have chosen to create
UDFs to both read and receive messages.
222 Preparing for DB2 Near-Realtime Business Intelligence
Figure D-4 Select both UDFs
We now need to define a service point for the queue over which we want to build
a view. If you do not assign a service point, the queue view will based on default
queue enabled by enable_MQFunctions, which is the DB2MQ_DEFAULT_MQM
queue.
For the project we built a queue view for the
QUEUE_FACT_ITEM queue.
Therefore, we needed to define a service point for that queue. We gave the
service point the name
FACT_ITEM. Figure D-5 on page 223 displays the step
to create the service point name.
Appendix D. WebSphere MQ and DB2 MQ Listener 223
Figure D-5 Service point definition
Next you need define the mapping between queue message data and DB2
columns in the Queue View.
Figure D-6 on page 224 shows the step to map the data in the MQ queue to the
table column names in the DB2 view.
224 Preparing for DB2 Near-Realtime Business Intelligence
Figure D-6 Mapping queue content to table columns
Upon successful completion of the data mapping, the development center can
now create the two UDFs for the Queue View over the Fact Queue. Figure D-7 on
page 225 shows that the two UDFs have been created and been given the
names
QV_Receive_Fact and QV_Read_Fact.

Get Preparing for DB2 Near-Realtime Business Intelligence now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.