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 » MQCONN failed in C program converted from UNIX to Windows

Post new topic  Reply to topic Goto page 1, 2  Next
 MQCONN failed in C program converted from UNIX to Windows « View previous topic :: View next topic » 
Author Message
lifeng
PostPosted: Fri Jan 11, 2008 8:46 am    Post subject: MQCONN failed in C program converted from UNIX to Windows Reply with quote

Apprentice

Joined: 11 Jan 2008
Posts: 46

Hi there,

We have been running a UNIX/C based system that communicates with MQSeries through API. That system works fine under UNIX. Now I am assigned the task of porting the system over to Windows. What I have done so far is:

1) I have installed MQSeries (v5.3) on my local machine.
2) Created a local queue manager named QM_QICLINK, which is the same name we use under UNIX.
3) Created a couple of local queues under QM_QICLINK.
4) Brought the C program over and compiled under Windows on the same machine MQSeries installed on.
5) Ran the program and try to call MQCONN with the following code:

char QMName[50]="";
QMName[0]='\0';
strcpy(QMName,"QM_QICLINK");
QMName[10]='\0';
MQHCONN Hcon;
MQLONG CompCode;
MQLONG CReason;
MQCONN(QMName, &Hcon, &CompCode, &CReason);

Then the call came back failed with a return code CompCode = 2 and CReason = 2058.

I am new to MQSeries and its APIs but as far as I can see, I am trying to keep everything the same as under UNIX. What am I missing here? If someone could shed some light it will be highly appreciated.

Thanks in advance!

Lifeng
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jan 11, 2008 9:00 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

try using amqscnx to connect to the qmgr.

Make sure that the queue manager is started.

If you're moving the program from unix to Windows, you should be moving it to use a supported (v6) version of MQ, instead of keeping the same unsupported v5.3.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
lifeng
PostPosted: Fri Jan 11, 2008 9:24 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jan 2008
Posts: 46

Hi jefflowrey,

Thanks for your response!

You have to excuse me for my ignorance on MQSeries. Like I said, I am really new in this field. Could you elaborate a little bit more on "using amqscnx to connect to the qmgr"? Is AMQSCNX the Windows equivalent of MQCONN of UNIX? Is this only available for V6? Where can I find API doc for it? All the API doc, including the Windows sample code come with the MQSeries for Windows installation, seems suggesting that MQCONN should work in my case, but how come I couldn't make it happen?

Once again, thank you so much for your valuable inputs!!!

Lifeng
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Fri Jan 11, 2008 9:31 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

lifeng wrote:
Could you elaborate a little bit more on "using amqscnx to connect to the qmgr"? Is AMQSCNX the Windows equivalent of MQCONN of UNIX? Is this only available for V6? Where can I find API doc for it?


Its a sample program shipped with all MQ Client installs. Its as simple as it gets, it just connects to the QM and then disconnects. We use it to prove that your MQ Client machine can get to the QM. If not, don't worry about your app yet, get the connectivity via amqscnxc going first. Once that works you know your app should be able to as well.

Source code is provided as well for amqscnxc.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Jan 11, 2008 9:32 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

If you are just starting out, then you should move to v6 since v5.3 is long out of support.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
lifeng
PostPosted: Fri Jan 11, 2008 11:18 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jan 2008
Posts: 46

I ran amqscnxc and this is what I got:

C:\Program Files\IBM\WebSphere MQ\Tools\c\Samples>amqscnxc QM_QICLINK
Sample AMQSCNXC start
Connecting to queue manager QM_QICLINK
with no client connection information specified.
MQCONNX ended with reason code 2058

I also tried call amqscnxc without argument but that didn't make any difference. I got the same error for connecting to DEFAULT queue manager.

Can someone tell me what is wrong here? What is the "client connetion information"? How do I specify it?

Thanks!

Lifeng
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Jan 11, 2008 11:33 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Check out the prologue of the program. You need to specify various parameters based on what you are trying to do.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
jefflowrey
PostPosted: Fri Jan 11, 2008 11:50 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Isn't there a bindings version of amqscnxc? I guess not. Dang memory - at least it brought back the coffee..

Try amqsput. It's simpler, and will connect to the local qmgr using a bindings connection, which your code is also trying to do.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Fri Jan 11, 2008 12:04 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

lifeng,
what does the output of the command dspmq show?
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
lifeng
PostPosted: Fri Jan 11, 2008 1:16 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Jan 2008
Posts: 46

1) Output of dspmq is:

C:\Program Files\IBM\WebSphere MQ\Tools\c\Samples\Bin>dspmq
QMNAME(QM_QICLINK) STATUS(Running)
QMNAME(QM_THG) STATUS(Running)

2) Output of amqsput is:
C:\Program Files\IBM\WebSphere MQ\Tools\c\Samples\Bin>amqsput BS_QICLINK_270
Sample AMQSPUT0 start
MQCONN ended with reason code 2059

Here the BS_QICLINK_270 is a queue defined under QM_QICLINK

3) I tried running MQCONN in API Exerciser against queue manager QM_QICLINK and it works fine (return status OK). I can even do a MQPUT and MQGET against BS_QICLINK_270 with API Exerciser and QM_QICLINK.

Any ideas?

Thanks you guys so much!!!

Lifeng
Back to top
View user's profile Send private message
lifeng
PostPosted: Fri Jan 11, 2008 2:06 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Jan 2008
Posts: 46

I just found that I made a mistake in running amqsput command by missing an argument - queue manager name. When I corrected this and run it, it works. After running this command, I can see the message I put in the queue from the MQ Explorer.

When I tried to run my own code to call MQCONN, however, it still failling - I still get the 2058 reason code back.

Does that mean that my local queue manager is OK but my program is bad? But as far as I can see, I am doing the same thing the amqsput0.c source code is doing. I don't know if it has anything to do with the issue, but maybe I should mention this as well, my application is a .Net application. The C code is now running under .Net as well but it is running as un-managed code.

Thanks again.

Lifeng
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jan 14, 2008 1:54 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

lifeng wrote:
Does that mean that my local queue manager is OK but my program is bad?


I'm afraid it does.

The code may be doing the same thing as the sample, but what it's not doing is correctly suppling your queue manager name to the MQCONN call. The 2058 (as you've undoubtedly discovered from your own reaearches) means the queue manager you're trying to connect to can't be found.

Double check the code setting the queue manager name. Especially if you're still using the code fragment in your first post!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Jan 14, 2008 3:32 am    Post subject: Reply with quote

Grand High Poobah

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

And remember here names are case sensitive. If the case doesn't match the connection will fail.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
lifeng
PostPosted: Mon Jan 14, 2008 7:14 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jan 2008
Posts: 46

Thank you again for all of your inputs & advises.

Based on my research over the weekend I am now more convinced that my problem has something to do with the fact that my program calling MQCONN is a .Net program (unmanaged C++ .Net program), not a Windows based C program, like those samples are.

Now, let me ask you the following:

1) is there a recommended approach from MQSeries that a unmanaged .Net program should follow in communicating with MQ using API? Since my program is converted from a native C program and it it big and very complex, I prefer not to convert it into managed .Net code if possible.

2) if I must convert my code into managed, then what is standard approach for a .Net program to invoke a native MQSeries API function, such as MQCONN, without installing any additional MQ components?

3) what my other options are?

Thanks again for all of your help!!!

Lifeng
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 14, 2008 7:36 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I think it's most likely that your environment is configured to link the .NET code against the client library when you have server installed, or vice versa.

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzav.doc/defconn.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » MQCONN failed in C program converted from UNIX to Windows
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.