无法连接到远程 MQ

Unable to connect to remote MQ

我正在尝试连接到远程 IBM MQ 服务器。但是我收到错误无法加载库 mqjbnd.dll。我不确定为什么要使用绑定模式。下面粘贴了一段使用的代码。在阅读了包括堆栈溢出在内的各种回复后,我发现客户端模式应该用于我的场景。但是我无法配置客户端模式。对此的任何帮助将不胜感激

// Create a connection to the QueueManager
  System.out.println("Connecting to queue manager: " + qManager);
  MQQueueManager qMgr = new MQQueueManager(qManager);

  // Set up the options on the queue we wish to open
  int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT;

  // Now specify the queue that we wish to open and the open options
  System.out.println("Accessing queue: " + qName);
  MQQueue queue = qMgr.accessQueue(qName, openOptions);

当您使用客户端模式时,需要在使用 TCP/IP 连接时设置一系列属性。例如,这将包括程序通过网络连接到 QM 所需的主机、端口和详细信息。此处是一个指示性示例。

Hashtable<String, Object> mqKeyValueProps = new Hashtable<String, Object>();
mqKeyValueProps.put(CMQC.HOST_NAME_PROPERTY, hostName);
mqKeyValueProps.put(CMQC.PORT_PROPERTY, new Integer(portNumber));
mqKeyValueProps.put(CMQC.CHANNEL_PROPERTY, channelName);
mqKeyValueProps.put(CMQC.USER_ID_PROPERTY, userID);
mqKeyValueProps.put(CMQC.PASSWORD_PROPERTY, password);
try
{

    MQQueueManager qMgr = new MQQueueManager(qManager,mqKeyValueProps);

    int openOptions = MQConstants.MQOO_INPUT_AS_Q_DEF | MQConstants.MQOO_OUTPUT;

  // Now specify the queue that we wish to open and the open options
    System.out.println("Accessing queue: " + qName);
    MQQueue queue = qMgr.accessQueue(qName, openOptions);
}
catch (com.ibm.mq.MQException mqex)
{
   System.out.println("MQException cc=" +mqex.completionCode + " : rc=" + mqex.reasonCode);
}