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 IndexIBM MQ Installation/Configuration SupportMQ Client Connection using C Programming

Post new topicReply to topic Goto page 1, 2  Next
MQ Client Connection using C Programming View previous topic :: View next topic
Author Message
aravindks3
PostPosted: Sun Jun 18, 2017 9:37 pm Post subject: MQ Client Connection using C Programming Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

My Application is return in Pro*C language and these days we were referring to Queue manager running locally.
But now we are changing it to take from CCDT file.
So i have set MQCHLLIB and MQCHLTAB environment variables.
And when i try amqsputc from AIX terminal, it works.
i used "./amqsputc <QUEUE_NAME> *<GROUP_NAME>" because i donot know exact queue manager.
But when i try from my application code, i am getting 2058 error. My Application uses MQCONN method for getting connection handle.
Please help me whether any library missing to read the CCDT file.[/b]
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Jun 18, 2017 10:28 pm Post subject: Reply with quote

Grand Poobah

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

Look at the linkage of your libraries. The library for client connection is not the same as the library for a server connection. You have to be able to dynamically link to the correct libraries.

Remember that you can only be logged in locally to a single queue manager at a time..

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Jun 19, 2017 4:03 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17446

In newer versions of MQ, you are supposed to only have to build and link against libmqm, and not libmqic... with libmqm knowing that you are making a server or client connection and behaving correctly.

But I can't seem to find documentation.
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Jun 19, 2017 5:46 am Post subject: Reply with quote

Grand Poobah

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

mqjeff wrote:
In newer versions of MQ, you are supposed to only have to build and link against libmqm, and not libmqic... with libmqm knowing that you are making a server or client connection and behaving correctly.

But I can't seem to find documentation.

Well the question remains: is libmqm even present if you have a client install only?
Because I suppose you'd want to write your program so that it works regardless of whether you're on a server install or on a client install...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Jun 19, 2017 8:24 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17446

fjb_saper wrote:
mqjeff wrote:
In newer versions of MQ, you are supposed to only have to build and link against libmqm, and not libmqic... with libmqm knowing that you are making a server or client connection and behaving correctly.

But I can't seem to find documentation.

Well the question remains: is libmqm even present if you have a client install only?


Yes.

I believe that libmic isn't present anymore. But that may just be my lack of recent C coding with MQ.
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
hughson
PostPosted: Mon Jun 19, 2017 4:17 pm Post subject: Reply with quote

Shaman

Joined: 09 May 2013
Posts: 727
Location: Bay of Plenty, New Zealand

mqjeff wrote:
fjb_saper wrote:
mqjeff wrote:
In newer versions of MQ, you are supposed to only have to build and link against libmqm, and not libmqic... with libmqm knowing that you are making a server or client connection and behaving correctly.

But I can't seem to find documentation.

Well the question remains: is libmqm even present if you have a client install only?


Yes.

I believe that libmic isn't present anymore. But that may just be my lack of recent C coding with MQ.


I believe libmqic is still present and can still be linked with. Otherwise applications would have broken at the time it was removed.

However, if your application is already linked with libmqm then it can make a client connection or a local connection. You can force it's hand by using the MQ_CONNECT_TYPE environment variable, or it will try one of each, local first, then client, until it connects, or reports a failure.

aravindks3 wrote:
My Application is return in Pro*C language and these days we were referring to Queue manager running locally.
But now we are changing it to take from CCDT file.
So i have set MQCHLLIB and MQCHLTAB environment variables.
And when i try amqsputc from AIX terminal, it works.
i used "./amqsputc <QUEUE_NAME> *<GROUP_NAME>" because i donot know exact queue manager.
But when i try from my application code, i am getting 2058 error. My Application uses MQCONN method for getting connection handle.
Please help me whether any library missing to read the CCDT file.


A 2058 error when trying to read a CCDT means that the client couldn't find the queue manager name from the MQCONN in any record in the CCDT's QMNAME. Since you are using '*', that means it is looking for a record with QMNAME(' ').

What is in the QMNAME field of your CLNTCONN definition in the CCDT?

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
exerk
PostPosted: Tue Jun 20, 2017 2:03 am Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 5722

Sorry Morag! I hit the damn edit button by mistake - working to restore your original post

What I meant to say was:

hughson wrote:
...Since you are using '*', that means it is looking for a record with QMNAME(' ')...

Or *FRED, or *BARNEY, if specific profiles are being used
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.

Back to top
View user's profile Send private message
hughson
PostPosted: Tue Jun 20, 2017 3:05 am Post subject: Reply with quote

Shaman

Joined: 09 May 2013
Posts: 727
Location: Bay of Plenty, New Zealand

exerk wrote:
hughson wrote:
...Since you are using '*', that means it is looking for a record with QMNAME(' ')...

Or *FRED, or *BARNEY, if specific profiles are being used
You'ree quite right. I misread his post to mean he was connecting to a QMgr called * but now that I read it again I see that it says *<GROUPNAME>. I think I viewed that as another parameter when I read it the first time.

So it needs an entry in the CCDT called <GROUPNAME>

Must wait until I've had my first coffee before reading these things!

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
hughson
PostPosted: Tue Jun 20, 2017 3:09 am Post subject: Re: MQ Client Connection using C Programming Reply with quote

Shaman

Joined: 09 May 2013
Posts: 727
Location: Bay of Plenty, New Zealand

aravindks3 wrote:
My Application is return in Pro*C language and these days we were referring to Queue manager running locally.
But now we are changing it to take from CCDT file.
So i have set MQCHLLIB and MQCHLTAB environment variables.
And when i try amqsputc from AIX terminal, it works.
i used "./amqsputc <QUEUE_NAME> *<GROUP_NAME>" because i donot know exact queue manager.
But when i try from my application code, i am getting 2058 error. My Application uses MQCONN method for getting connection handle.
Please help me whether any library missing to read the CCDT file.[/b]
Since you know that it works with the above amqsputc command, then your CCDT is all good. You need to replicate the same MQCONN call in your own application. Are you using the same queue manager name in your own application, i.e. *<GROUPNAME>?

Apologies for misreading your question earlier.
Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
aravindks3
PostPosted: Tue Jun 20, 2017 10:16 pm Post subject: Re: MQ Client Connection using C Programming Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

Thanks for the reply, But i came to know if i set up MQSERVER environment variable and try to use amqsputc, i am able to connect.
If i unset the MQSERVER variable and set up only MQCHLLIB and MQCHLTAB then amqsputc is also not working.
I tried with group name, MQ manager name as specified in CCDT file and with * also before group name. Still i get 2058 error.

hughson wrote:
aravindks3 wrote:
My Application is return in Pro*C language and these days we were referring to Queue manager running locally.
But now we are changing it to take from CCDT file.
So i have set MQCHLLIB and MQCHLTAB environment variables.
And when i try amqsputc from AIX terminal, it works.
i used "./amqsputc <QUEUE_NAME> *<GROUP_NAME>" because i donot know exact queue manager.
But when i try from my application code, i am getting 2058 error. My Application uses MQCONN method for getting connection handle.
Please help me whether any library missing to read the CCDT file.[/b]
Since you know that it works with the above amqsputc command, then your CCDT is all good. You need to replicate the same MQCONN call in your own application. Are you using the same queue manager name in your own application, i.e. *<GROUPNAME>?

Apologies for misreading your question earlier.
Cheers
Morag
Back to top
View user's profile Send private message
aravindks3
PostPosted: Tue Jun 20, 2017 10:20 pm Post subject: Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

My Library is linked to /usr/mqm/lib64/ which has following libraries
libmqicb_r.a , libmqicb.a, libmqic_r.a, libmqic.a.
Is there any other jar file to be present in the installation path.
Because MQ admin team has installed this 4 years back and till date my application is using the same.

fjb_saper wrote:
Look at the linkage of your libraries. The library for client connection is not the same as the library for a server connection. You have to be able to dynamically link to the correct libraries.

Remember that you can only be logged in locally to a single queue manager at a time..

Have fun
Back to top
View user's profile Send private message
hughson
PostPosted: Tue Jun 20, 2017 11:09 pm Post subject: Reply with quote

Shaman

Joined: 09 May 2013
Posts: 727
Location: Bay of Plenty, New Zealand

aravindks3 wrote:
My Library is linked to /usr/mqm/lib64/ which has following libraries
libmqicb_r.a , libmqicb.a, libmqic_r.a, libmqic.a.
Is there any other jar file to be present in the installation path.

You are writing a C application, Therefore jar files do not come into the equation.

Sounds like you only have the client libmqic* variants installed? That is fine though as you are trying to make a client connection anyway.

What QMgr name is your MQCONN call passing in? Does it match the QMNAME of an entry in your CCDT? (asterisks aside)

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
aravindks3
PostPosted: Wed Jun 21, 2017 12:25 am Post subject: Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

As per the CCDT file contents given by MQ team for me, i have tried same name.
So i have asked the MQ team to check revert me on the same. Waiting for their reply.
Will update you soon on the outcome after their reply.
Thanks for the response.


hughson wrote:
aravindks3 wrote:
My Library is linked to /usr/mqm/lib64/ which has following libraries
libmqicb_r.a , libmqicb.a, libmqic_r.a, libmqic.a.
Is there any other jar file to be present in the installation path.

You are writing a C application, Therefore jar files do not come into the equation.

Sounds like you only have the client libmqic* variants installed? That is fine though as you are trying to make a client connection anyway.

What QMgr name is your MQCONN call passing in? Does it match the QMNAME of an entry in your CCDT? (asterisks aside)

Cheers
Morag
Back to top
View user's profile Send private message
exerk
PostPosted: Wed Jun 21, 2017 1:18 am Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 5722

aravindks3 wrote:
As per the CCDT file contents given by MQ team for me, i have tried same name.
So i have asked the MQ team to check revert me on the same. Waiting for their reply.

Try THIS.
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.

Back to top
View user's profile Send private message
aravindks3
PostPosted: Wed Jun 21, 2017 6:11 pm Post subject: Reply with quote

Novice

Joined: 18 Jun 2017
Posts: 15

Thanks for the article. It was very useful to understand about the MQCONN call. But as i am still unable to test the queue using amqsputc, i am waiting for the MQ team reply from my company to check the Queue Manager name or group name.
Once i am successfull with amqsputc, i will definitely consider the points in the article mentioned for MQCONN call.

exerk wrote:
aravindks3 wrote:
As per the CCDT file contents given by MQ team for me, i have tried same name.
So i have asked the MQ team to check revert me on the same. Waiting for their reply.

Try THIS.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum IndexIBM MQ Installation/Configuration SupportMQ Client Connection using C Programming
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.