Author |
Message
|
klamerus |
Posted: Thu Jun 23, 2005 4:54 am Post subject: Queues on remote servers |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
Just using an extract from one of the samples,
What sort of string would I provide for qmName to connect to a queue manager named "Bob" on a remote server named "Bill" that was running on the default ports?
MQCONN(qmName, &hConn, &compCode, &connReason);
I've never quite gotten this to work. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jun 23, 2005 4:56 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It depends on how you have defined the client connection information...
But usually it's a good idea to put in the actual Qmgr name. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
klamerus |
Posted: Thu Jun 23, 2005 5:09 am Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
Yes, I'm really looking for the syntax of how to put together the queue manager name. |
|
Back to top |
|
 |
kevinf2349 |
Posted: Thu Jun 23, 2005 5:11 am Post subject: |
|
|
 Grand Master
Joined: 28 Feb 2003 Posts: 1311 Location: USA
|
Quote: |
MQCONN(qmName, &hConn, &compCode, &connReason); |
Try
Quote: |
MQCONN("your qmgr", &hConn, &compCode, &connReason); |
|
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jun 23, 2005 5:15 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The queue manager name in all cases will be "Bob". Except that, in some cases, you can leave it blank.
The parameters to establish a client connection are not specified in the MQCONN call directly. They are established in one of three ways - Through a properly formatted MQSERVER environment variable
- Through a lookup of the Qmgr Name in the MQ Client Channel Table (located using the MQCLNT* Environment variables)
- Through the parameters to MQCONNX
At least in things like VB and C/C++ that use the MQCONN call. The .NET object-oriented interface uses the MQEnvironment object - as does the Java object-oriented interface. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
klamerus |
Posted: Thu Jun 23, 2005 5:25 am Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
I was hoping there might be another syntax something like the UNC notation. For instance:
\\BILL(1414)\Bob
or something similar. Especially in a program that needs to connect and work with multiple remote queue managers. For instance, if we want to query the depths on queues on 5 separate servers from a single centralized location, you'd prefer to not be playing games iwth environmental variables.
So, It MQCONNX is might be better. I haven't used that before, but can you toss out how to use that to connect to QM BOB on server BILL? |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Jun 23, 2005 5:30 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Code: |
'**************************************************************************************
' Build a hash table to hold all the connection info
'**************************************************************************************
Dim myHashTable As New Hashtable
myHashTable.Add(IBM.WMQ.MQC.HOST_NAME_PROPERTY, "TheHostName") 'TheHostName = "Bill"
myHashTable.Add(IBM.WMQ.MQC.PORT_PROPERTY, ThePort)
myHashTable.Add(IBM.WMQ.MQC.CHANNEL_PROPERTY, "TheChannelName")
'**************************************************************************************
' Connect to the Queue Manager - Note you do not need to specify a QM name for clients
'**************************************************************************************
myQMObject = New MQQueueManager(" ", myHashTable)
|
That's how I do it in VB.NET _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jun 23, 2005 5:35 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
klamerus wrote: |
I haven't used that before, but can you toss out how to use that to connect to QM BOB on server BILL? |
Use the object oriented interface, exactly how Peter showed you. It's vastly simpler than using MQCONNX.
Otherwise, see http://www.mqseries.net/phpBB2/viewtopic.php?t=22794 _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
klamerus |
Posted: Thu Jun 23, 2005 5:39 am Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
Sorry, so to jump back I should clarify I'm looking at C. A sample in C would be what I'm looking for here.
That being said, we are going in the VB.Net direction on everything here - so I'd appreciate anyone forwarding me any code (no matter how "unproud" people may be of it) to help us build up on samples in that area.
Given your example in VB.Net, if you don't specify a QM, and if we're looking to connect to a queue (named BOB), what would we put in the ChannelName to get to that queue |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jun 23, 2005 5:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
klamerus wrote: |
A sample in C would be what I'm looking for here. |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Thu Jun 23, 2005 6:13 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
klamerus wrote: |
Given your example in VB.Net, if you don't specify a QM, and if we're looking to connect to a queue (named BOB), what would we put in the ChannelName to get to that queue |
Your MQAdmin will tell your what SVRCONN channel is available on the QM for you to use to connect a client to. He / She will also provide the port #. Any you alreadt nknow the hostname.
Because there can only be 1 QM, ever, listening on a particular hostname / port number, that is unique enough, and thus you do not need the QM name in the connect, although if you want, you can code it. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
klamerus |
Posted: Thu Jun 23, 2005 6:17 am Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
Very nice pointer/reference. Thank you.
I like the response about the person's "#$!!#!@!#!@" code.
Too funny  |
|
Back to top |
|
 |
klamerus |
Posted: Thu Jun 23, 2005 6:22 am Post subject: |
|
|
 Disciple
Joined: 05 Jul 2004 Posts: 199 Location: Detroit, MI
|
I think I'll take a spin at the VB.Net with this one too. That is where we want to go with this. Perhaps now is the time.
Now I just have to figure out how to get my working sample doing the Statistics Resets to work in the .Net framework  |
|
Back to top |
|
 |
|