ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Connecting to ImqQueueManager using QM/host/port/CHL

Post new topic  Reply to topic
 Connecting to ImqQueueManager using QM/host/port/CHL « View previous topic :: View next topic » 
Author Message
vbajwa
PostPosted: Wed Feb 07, 2007 12:49 pm    Post subject: Connecting to ImqQueueManager using QM/host/port/CHL Reply with quote

Newbie

Joined: 31 Jan 2007
Posts: 8

My program has to connect to three different QMs. From the API docs the ImqQueueManager only takes a QM name string. However the MQSERVER environment variable has to be set from outside like:
export MQSERVER="MY_CHANNEL/TCP/MY_HOSTNAME(portNum)"

Is there any programmatic way to specify these parameters as it not be possible to open more than 1 QM using the env. variable technique? I looked at the API docs in this forum, but no luck. And what is a local queue manager the docs talk about?

Thanks a lot for the info!

Vijay
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Feb 07, 2007 1:03 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.amqzan.doc/amqzan09145.htm
Quote:
ImqBoolean connect( );
Connects to the queue manager with the given ImqObject name, the default being the local queue manager. If you want to connect to a specific queue manager, use the ImqObject setName method before connection. If there is a channel reference, it is used to pass information about the channel definition to MQCONNX in an MQCD. The ChannelType in the MQCD is set to MQCHT_CLNTCONN. channel reference information, which is only meaningful for client connections, is ignored for server connections. The connect options affect the behavior of this method. This method sets the connection status to TRUE if successful. It returns the new connection status.

If there is a first authentication record, the chain of authentication records is used to authenticate digital certificates for secure client channels.

You can connect more than one ImqQueueManager object to the same queue manager. All use the same MQHCONN connection handle and share UOW functionality for the connection associated with the thread. The first ImqQueueManager to connect obtains the MQHCONN handle. The last ImqQueueManager to disconnect performs the MQDISC.

For a multithreaded program, each thread must use a separate ImqQueueManager object. Connections in different threads have different MQHCONN connection handles.

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vbajwa
PostPosted: Wed Feb 07, 2007 4:28 pm    Post subject: Reply with quote

Newbie

Joined: 31 Jan 2007
Posts: 8

jefflowrey wrote:

Thanks for your reply! I learned something, but I still don't see how I can set hostname, port number and channel number.

Also, what exactly does it mean to say: "local queue manager" ?

Thanks!
Vijay
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Feb 07, 2007 7:10 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

vbajwa wrote:
jefflowrey wrote:

Thanks for your reply! I learned something, but I still don't see how I can set hostname, port number and channel number.

Read up in the programer manual about MQCONNX...
A search in the infocenter should give you enough hits...
vbajwa wrote:
Also, what exactly does it mean to say: "local queue manager" ?

Read : The default being the local queue manager or the default being the qmgr you specified on the box you're executing on...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Feb 08, 2007 2:23 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Or set the client channel environment variables, and use the queue manager name to specify which entry from the table to use.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vbajwa
PostPosted: Thu Feb 08, 2007 8:42 am    Post subject: Reply with quote

Newbie

Joined: 31 Jan 2007
Posts: 8

jefflowrey wrote:

OK, I think I got it, also found this useful bit of code. Thanks to all for pointing in the right direction. The link is: http://www.mqfaq.com/webspheremq.php

mgr.setName(argv[1]);
in_queue.setName(argv[2]);
out_queue.setName(argv[3]);
mgr.setName();

//Initialize channel values
//Warning: hard-coded values
channel.setChannelName("CHAN1");
channel.setTransportType( MQXPT_TCP );
channel.setConnectionName("10.40.60.68(1414)");

//Associate this channel with the queue manager
mgr.setChannelReference(channel);

//Connect to the queue manager
if ( !mgr.connect() ) {
...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Connecting to ImqQueueManager using QM/host/port/CHL
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.