Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple client connections - how?

Status
Not open for further replies.

dthomas

Programmer
Mar 1, 2002
9
0
0
US
I am having a problem connecting to multiple MQSeries servers using the MQSeries client. I have 2 identical Queue managers, each on a different PC. They each are named the same:

Queue manager = Main
Queue name = In
Channel = Channel1

I connect to the 1st queue manager no problem. When I connect to the 2nd queue manager, I get back the same queue manager handle as I did from the 1st connection, and I get a reason code of 2002 - "Already connected".
Does MQSeries client require that you connect to queue managers with different names? Any help would be appreciated. Thanks.
 
Yes,

You need to have this queue managers names to be different.

Thanks
Satish Basvapatri
 
Actually, the MQCNO and MQCD structures are what control your connection to a queue manager, not the name of the queue manager. Specifically, the ConnectionName field of the MQCD defines the Host Name or Network Address (IP) of the server queue manager. This is what controls the connection. Although Satish is correct in stating that you SHOULD NOT create two queue managers with the same name, there is nothing stopping you from doing this, and as long as they are on physically separate boxes, your example should work fine (assuming you set the ConnectionName property up correctly for each of them).

Regards,

Scott Meridew Scott Meridew
Certified MQSeries Specialist,MCSE
MQ Squared Inc.
 
Thanks for the responses. I did use the MQCNO and MQCD structures (actually I used the MQCNOCD structure which combines MQCNO and MQCD). I set the ChannelName and ConnectionName members of MQCD, but I still got the 2002 error response. Any other ideas?
 
Are you disconnecting from the first queue manager, changing the connectionname (in MQCNOCD structure) and then connecting to the second queue manager? This should work, assuming the parameters are all correct. (IP address, port number, protocol).
Scott Meridew
Certified MQSeries Specialist,MCSE
MQ Squared Inc.
 
Actually, I was trying to connect to 2 different Queue Managers at the same time. I did not disconnect from the first before connecting to the second. Can I only have 1 connection open at a time?
 
If you are trying to connect to two Queuemanagers at the same time, are you doing this from different threads? The difference in conecntion comes in the QueueConnectionFactory. In short, your QCF is different for each of these QMGRs. So, you have to make another connection to connect to a different QMGR as atleast the port number will vary.

And unless these QMGRs are clustered, the same name for these QMGRs won't matter, I feel.
lecMns
B'lore
 
No, I am connecting from the same thread. Thanks to everyone who responded to my questions. I guess I'll have to rethink my approach to my problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top