IBM Support

Setting up MQ Client connectivity for Q Apply

General Page

This replaces the IBM Data Replication Community Wiki Setting up MQ Client connectivity for Q Apply page.
This document shows how one can set up an MQ Client connectivity for Q Apply.

This document shows how one can set up an MQ Client connectivity for Q Apply.

This link in IBM Knowledge Center shows how people who are familiar with using MQ Clients often set up Q Replication with client connectivity.

In the following example however, client connectivity is setup using an alternative method by avoiding the use of a client definition table.


The two systems involved in this example were:

  • systemA - location of the MQ Server containing the Q Manager (MYQMGR).
  • systemB - location where Q Apply runs and the target database (MYDB).

These steps assume that Q Apply control tables have already been created in the target DB, and the non client-related MQ Objects needed for Q Replication are already defined in the remote Q Manager.



1. Create the client-related objects on the remote Q Manager.

The two objects required are a channel of type SVRCONN defined on the Q Manager that will accept client connections, and a listener for that Q Manager.

Example of what to run the Q Manager MYQMGR on systemA

 

systemA:/home> runmqsc MYQMGR < createSrvChl.in

5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.

Starting MQSC for queue manager MYQMGR

1 : STOP CHANNEL(MYCHANNEL)

AMQ9533: Channel 'MYCHANNEL' is not currently active.

2 : DELETE CHANNEL(MYCHANNEL)

AMQ8015: WebSphere MQ channel deleted.

3 : DEFINE CHANNEL(MYCHANNEL) CHLTYPE(SVRCONN) TRPTYPE(TCP)

AMQ8014: WebSphere MQ channel created.

4 : START CHANNEL(MYCHANNEL)

AMQ8018: Start WebSphere MQ channel accepted.

5 : DEFINE LSTR (SVRCONN_LSR) TRPTYPE(TCP) CONTROL (QMGR) PORT (5555)

AMQ8626: WebSphere MQ listener created.

6 : START LSTR(SVRCONN_LSR)

AMQ8021: Request to start WebSphere MQ Listener accepted.

7 : END

7 MQSC commands read.

No commands have a syntax error.

All valid MQSC commands were processed.

This created and started an MQ channel of type SVRCONN, which will accept MQ client connections, and started the listener on port 5555.



2. Double check the QMGR


You should verify that the QMGR parameter in IBMQREP_APPLYPARMS is the same as the Q Manager where the objects were created on the remote system.

systemB:/home> db2 SELECT QMGR FROM ASN.IBMQREP_APPLYPARMS

QMGR

~~~--~~~--~~~--~~~--~~~--~~~--~~~--~~~--~~~--~~~--~~~--~~~

MYQMGR


3. Set the ASNUSEMQCLIENT environment variable


This variable instructs Q Apply to use an MQ Client connection. This should be done in the environment where Q Apply runs

 

systemB:/home> export ASNUSEMQCLIENT=true



4. Set the MQSERVER environment variable


You then need to tell the MQ Client where the QMGR is located. Because a client channel definition table is not used, this must be set explicitly.

To do this, set the MQSERVER variable using the CHANNEL/TRANSPORTTYPE/HOST(PORT) format:

systemB:/home> export MQSERVER="MYCHANNEL/TCP/systemA(5555)"



5. Start Q Apply

 

systemB:/home> asnqapp MYDB

2010-05-04-15.45.05.717997 ASN0600I "Q Apply" : "" : "Initial" : Program "mqapply 9.7.2" is starting.

2010-05-04-15.45.11.625731 ASN0572I "Q Apply" : "ASN" : "Initial" : The "mqapp 9.7.2" program initialized successfully.

If no errors show up, then Q Apply has successfully connected to the Q Manager!

It should also be noted that the same process applies to getting Q Capture to use MQ Client connectivity.




Troubleshooting

Here are a couple errors people may run into.



1. The program encountered a Websphere MQ error "2058" while issuing the WebSphere MQ command "MQCONN".


Example:
 

systemB:/home> asnqapp MYDB

2010-05-04-15.42.55.007657 ASN0600I "Q Apply" : "" : "Initial" : Program "mqapply 9.7.2" is starting.

2010-05-04-15.43.00.967603 ASN0572I "Q Apply" : "ASN" : "Initial" : The "mqapp 9.7.2" program initialized successfully.

2010-05-04-15.43.00.995719 ASN0575E "Q Apply" : "ASN" : "AdminThread" : The program encountered a WebSphere MQ error "2058" while issuing the WebSphere MQ command "MQCONN" on object "*".

2010-05-04-15.43.00.995775 ASN0575E "Q Apply" : "ASN" : "MonitorThread" : The program encountered a WebSphere MQ error "2058" while issuing the WebSphere MQ command "MQCONN" on object "*".



In this example, the MQ Connection failed with 2058. AMQ2058 means Q Manager name invalid or not available was returned. When using an MQ Client, this can be tricky to diagnose.

  • Check that the MQSERVER environment variable is the correct format
  • Check that the asnqapp program is picking up the MQSERVER variable (if you are running it from within another script, ensure that the environment within that script contains the same variable)
  • Check that the listener and SRVCONN channels are up and running on the QMGR
  • Check that the QMGR Q Apply is trying to connect to really is the QMGR defined at the MQSERVER endpoint.


2. An error occurred while the program was dynamically loading the WebSphere MQ library

Example:

systemB:/home> asnqapp MYDB

2010-05-04-15.42.55.007657 ASN0600I "Q Apply" : "" : "Initial" : Program "mqapply 9.7.2" is starting.

2010-05-04-15.43.00.967603 ASN0572I "Q Apply" : "ASN" : "Initial" : The "mqapp 9.7.2" program initialized successfully.

2010-07-21-10.08.42.377554 <ASNMQLOD:MQCONN> ASN0584E "Q Apply" : "ASN" : "AdminThread" : An error occurred while the program was dynamically loading the WebSphere MQ library "libmqic_r.a(mqic_r.o)". Error code: "0x90000076", "Cannot load the specified library". Environment variable ASNUSEMQCLIENT is set to "TRUE".

In this example, the Q Apply program returned an error when trying to load the MQ Library.

The error code can be analyzed using db2diag:

systemB:/home> db2diag -rc 0x90000076

Product :

DB2 Common

Component:

OSSe

Code:

118 (0x0076)

Identifier:

ECF_LIB_CANNOT_LOAD

Description:

Cannot load the specified library

There are a number of different reasons why a library cannot be loaded. Here are some to check when using an MQ Client:
 

  • Check that you have an MQ Client installed, and it is valid and supported for your operating system level.
  • Ensure that Q Apply is reading the ASNUSEMQCLIENT variable correctly. If it does not read it, it will try and load the MQ Server library, which will not be found if MQ Server is not installed on the system
  • Follow MQ's best practices for setting LIBPATH or LD_LIBRARY_PATH
  • Ensure that the userid running Q Apply has permission to execute the library that cannot be loaded
  • Use one of the sample client programs in case there is more information to be output from the failed attempt to load the library

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSTRGZ","label":"InfoSphere Data Replication"},"Component":"","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF051","label":"Linux on IBM Z Systems"},{"code":"PF033","label":"Windows"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
03 December 2019

UID

ibm11105023