Search code examples
javajmsibm-mqwebsphere-7mq

need to connect to MQ7 using Host_name, Queue_name, channel_name and binding file


I have details of Host_name, Queue_name, channel_name and binding file, Except Queue_manager name. and i need to connect to MQ 7. Please just give a connectivity program. I tried posting in this and other forums but the connection problem still persists. So i thought if anyone could help me with the code. I will be very happy if anyone help me to do this.


Solution

  • If you know Host name, channel name and port number, then you can get the queue manager name like below:

     MQEnvironment.channel = 'SYSTEM.DEF.SVRCONN'; //Replace with your channel name
     MQEnvironment.hostname = 'localhost'; //Replace with your host name
     MQEnvironment.port = 1414; //Replace with your port number
    
     MQQueueManager QM_OBJ= new MQQueueManager("");
    
     String QueueManagerName = QM_OBJ.getAttributeString(MQC.MQCA_Q_MGR_NAME, 100).trim();