Examples of MQCONN calls
Examples of using MQCONN to connect to a specific queue manager, or to one of a group of queue managers.
In each of the following examples, the network is the same; there is a connection defined to two servers from the same IBM MQ MQI client. (In these examples, the MQCONNX call could be used instead of the MQCONN call.)
There are two queue managers running on the server machines, one named SALE and the other named SALE_BACKUP.The definitions for the channels in these examples are:
SALE definitions:DEFINE CHANNEL(ALPHA) CHLTYPE(SVRCONN) TRPTYPE(TCP) + DESCR('Server connection to IBM MQ MQI client') DEFINE CHANNEL(ALPHA) CHLTYPE(CLNTCONN) TRPTYPE(TCP) + CONNAME(9.20.4.26) DESCR('IBM MQ MQI client connection to server 1') + QMNAME(SALE) DEFINE CHANNEL(BETA) CHLTYPE(CLNTCONN) TRPTYPE(TCP) + CONNAME(9.20.5.26) DESCR('IBM MQ MQI client connection to server 2') + QMNAME(SALE)SALE_BACKUP definition:DEFINE CHANNEL(BETA) CHLTYPE(SVRCONN) TRPTYPE(TCP) + DESCR('Server connection to IBM MQ MQI client')The client channel definitions can be summarized as follows:
Name CHLTYPE TRPTYPE CONNAME QMNAME ALPHA CLNTCONN TCP 9.20.4.26 SALE BETA CLNTCONN TCP 9.20.5.26 SALE
- What the MQCONN examples demonstrate
The examples demonstrate the use of multiple queue managers as a backup system.- Example 1. Queue manager name includes an asterisk (*)
In this example the application is not concerned about which queue manager it connects to. The application issues an MQCONN call for a queue manager name including an asterisk. A suitable channel is chosen.- Example 2. Queue manager name specified
In this example the application must connect to a particular queue manager. The application issues an MQCONN call for that queue manager name. A suitable channel is chosen.- Example 3. Queue manager name is blank or an asterisk (*)
In this example the application is not concerned about which queue manager it connects to. The application issues an MQCONN specifying a blank queue manager name or an asterisk. A suitable channel is chosen.Parent topic: Connect IBM MQ MQI client applications to queue managers