ChannelDB2

A Fast Way to Get Started with WebSphere MQ for DB2

Q Replication, by using DB2's
MQ UDFs, or by
coordinating the commit of transactions to DB2 and MQ. However, I find that a lot of DB2 people are hesitant to try these features because they're unfamiliar with MQ. That really shouldn't stop them :) Especially now. Starting with 9.7 FP4, DB2 has a new command (actually, much improved command) that makes it very easy to set up MQ for use with DB2.
This command is geared towards use with Q Replication, but the MQ objects it creates could be used with any function combining DB2 and MQ.




Before You Start



the Client from ibm.com's DB2 pages without affecting your DB2 server.


Do It Yourself





<1. Bring up a DB2 command window, create a directory called myscripts under, say, C:, and switch to it:

mkdir c:\myscripts
cd \myscripts

<2. Copy and paste the following text (explained later) into a file named mq.asnclp in c:\myscripts:

asnclp session set to q replication;
create mq script
config type u
mqserver 1 name sample mqhost "spongebob.svl.ibm.com" mqport "2404",
mqserver 2 name cognos mqhost "spongebob.svl.ibm.com" mqport "2405";

<3. Change "spongebob.svl.ibm.com" to the host name or IP address of your system (or 'localhost' if you prefer) and save the file.

<4. Issue the following command from your DB2 command window:

asnclp -f mq.asnclp

<5. Run the following two batch files (explained later) that were generated by the asnclp command:

qrepl.sample.mq_windows.bat
qrepl.cognos.mq_windows.bat


qrepl.sample.mq_aixlinux.sh
qrepl.cognos.mq_aixlinux.sh


<6. You can verify your queue managers are running by issuing the following command:

dspmq



QMNAME(COGNOS) STATUS(Running)
QMNAME(SAMPLE) STATUS(Running)

7. You can verify the queues are correct using the DB2 Replication Center.

This requires you create a few tables for Q Replication, but you do not have to run Q Replication just to verify queues. See how to do it in the ChannelDB2 video titled
Verifying MQ for Q Replication. At some point, I'll have posts that show other ways to verify your MQ will work for DB2 needs.


What's in the File called mq.asnclp?

Like I said earlier, the asnclp
Create MQ Script command is geared towards use with Q Replication but the resulting MQ objects can be used any way you want. For this exercise, though, the important things to know are the following:

  • The recommended name for your MQ server (queue manager) is the same as the database it will be used with.
    • In this example, I assume you will eventually have databases called Sample and Cognos.
    • This is not required, just a recommendation.

  • The command needs the host name or IP address for the system where each queue manager will be created.
    • That's the first quoted string in each of the last two lines ("spongebob.svl.ibm.com").
    • For this exercise, the DB2 servers and MQ servers must be colocated on the same system(s).

  • Each queue manager needs a TCP/IP port where it receives messages from the other queue manager.
    • That's the second quoted string in each of the last two lines ("2404" and "2405").


What's in the Batch Files and Shell Scripts?

The asnclp command uses the information in mq.asnclp to create four files - two batch files for Windows and two shell scripts for UNIX. Each file can create one queue manager and all necessary MQ objects (queues, channels, listener) for that queue manager. The name of the queue manager is included in the file name.

These batch files/scripts first create an MQ script file that define 6-7 MQ objects. They then run three MQ commands - one to create the queue manager, one to start the queue manager, and one to pass the MQ script to the queue manager.

You'll eventually want to learn more about these objects and MQ's commands after you finish working with this post. For example, what's a channel or how do I stop and restart queue managers :) The MQ Information Center is an excellent resource for this. That's were the tutorial and Flash overview are. It also contains reference information about
queue manager commands and
MQ scripting commands.

--

Views: 2482

Comment

You need to be a member of ChannelDB2 to add comments!

Join ChannelDB2

Featured Downloads

Try BLU Acceleration on Cloud

© 2019   Created by channeldb2.   Powered by

Badges  |  Report an Issue  |  Terms of Service