Yeah! Cracked it!

No, not the lens... (see previous post), but a programming problem I've had for, well, months.

I'm only posting this here 'cos if anyone else is going bonkers about how to connect to a Websphere (MQ) remote server queue when you've got both client and server 5.3 installed on your PC and you're using Visual Studio 2005 and you're using VB.NET and you keep getting ReasonCode = 2058, ReasonName = MQRC_Q_MGR_NAME_ERROR
and you can connect to the remote queue OK using the Websphere explorer and you're using Windows XP (phew).

Go to this link for a code snippet that demonstrates how to open a queue, check for content, read the message and finally close the queue. How you process the message is obviously up to you. The code only shows how to read ASCII messages.

I converted the original code from C# code to VB.NET.

The short answer is to use the MQEnvironment object and not the MQSession object. It's found by Importing IBM.WMQ and using AMQMDNET.DLL in the project references.

It's actually quite straight forward, you don't need to set the MQSERVER environment variable or anything else, but your local/network user name needs to be in the "mqm" group on your PC otherwise Windows will reject the connection attempt with the same error. I've not tried it with SSL Queues and/or Exits.

If this has been helpful, please leave a comment on the blog! Thanks.

Comments

Popular posts from this blog

"The delivery extension for this subscription could not be loaded" when using SSRS

Oooh, look, an Eagle...

SQL Server 2008 / Reporting Services