Author |
Message
|
kumaramit8 |
Posted: Thu Jan 31, 2013 5:17 am Post subject: Connecting to MQManager using MQ client with VBScript |
|
|
Newbie
Joined: 31 Jan 2013 Posts: 4
|
Hi All,
I am trying to connect to a MQ Server using below code from MQ client machine.I am using excel macro for the same.The code used is:
Set MQSess = CreateObject("MQAX200.MQSession")
Set QMgr = CreateObject("MQAX200.MQQueueManager")
Set QMgr1 = MQSess.AccessQueueManager("Q3T0102")
I am unablt to connect to queuemanager using macro even though with command prompt it is working fine.
Any advise will be highly praised.
Thanks in advance for your help.
Thanks & Regards,
-Amit |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jan 31, 2013 5:28 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You should be using the .NET classes, unless you are somehow using a version of windows that does not support .NET.
The code you have posted is for the VB interface, not for the VB.NET interface.
You haven't explained what error is returned when it 'doesn't work'.
You haven't explained the steps you have taken to make sure that all of the necessary environment is configured inside Excel so that when the macro is run, it can find the MQ libraries and etc. |
|
Back to top |
|
 |
kumaramit8 |
Posted: Thu Jan 31, 2013 11:19 am Post subject: details |
|
|
Newbie
Joined: 31 Jan 2013 Posts: 4
|
Error Code 2058 is getting displayed.
Already defined the MQServer system environment variable.Not sure Where am i going wrong.
Any suggestion will be highly praised.
Thanks & Regards,
-Amit |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jan 31, 2013 11:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
MQRC 2058 means that it can't find the queue manager you've asked for.
Generally with MQSERVER, you don't need to specify the name of a queue manager.
There's no guarantee that any environment variables you have set outside of Excel will be set for processes running inside Excel.
I've never bothered to write an Excel macro, so i can't give you any more specific advice.
Except, again, to use the .NET classes instead of the ActiveX interface. |
|
Back to top |
|
 |
kumaramit8 |
Posted: Thu Jan 31, 2013 11:34 am Post subject: |
|
|
Newbie
Joined: 31 Jan 2013 Posts: 4
|
MQSERVER=Q3T0102.QTP.T1/TCP/abcd.*.*.*.com(1414)
and the error is:MQAX200.MQSession::AcessQueueManagerCompletionCode=2,Reasoncode=2058,ReasonName = MQRC_Q_MGR_NAME_ERROR |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jan 31, 2013 11:45 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kumaramit8 wrote: |
MQSERVER=Q3T0102.QTP.T1/TCP/abcd.*.*.*.com(1414)
and the error is:MQAX200.MQSession::AcessQueueManagerCompletionCode=2,Reasoncode=2058,ReasonName = MQRC_Q_MGR_NAME_ERROR |
Yes, and your code
Code: |
Set QMgr1 = MQSess.AccessQueueManager("Q3T0102") |
I would typically expect
Code: |
Set QMgr1 = MQSess.AccessQueueManager() |
or
Code: |
Set QMgr1 = MQSess.AccessQueueManager("*") |
where I knew MQSERVEr was in effect.
but again, Just becuase you have set MQSERVER in a shell or in the environment, there's no reason to expect that Excel thinks it is set!
The environment for Excel macros may have ABSOLUTELY NOTHING to do with the shell that launched Excel or the global environment. |
|
Back to top |
|
 |
kumaramit8 |
Posted: Mon Feb 04, 2013 12:44 am Post subject: MQ |
|
|
Newbie
Joined: 31 Jan 2013 Posts: 4
|
Can somebody help me with this?I really need your help on priority. |
|
Back to top |
|
 |
|