Author |
Message
|
aravindks3 |
Posted: Sun Jun 18, 2017 9:37 pm Post subject: MQ Client Connection using C Programming |
|
|
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 |
|
 |
fjb_saper |
Posted: Sun Jun 18, 2017 10:28 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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 |
|
 |
mqjeff |
Posted: Mon Jun 19, 2017 4:03 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
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. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 19, 2017 5:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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 |
|
 |
mqjeff |
Posted: Mon Jun 19, 2017 8:24 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
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. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
hughson |
Posted: Mon Jun 19, 2017 4:17 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 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
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
exerk |
Posted: Tue Jun 20, 2017 2:03 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
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 |
|
 |
hughson |
Posted: Tue Jun 20, 2017 3:05 am Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 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
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
hughson |
Posted: Tue Jun 20, 2017 3:09 am Post subject: Re: MQ Client Connection using C Programming |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 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
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
aravindks3 |
Posted: Tue Jun 20, 2017 10:16 pm Post subject: Re: MQ Client Connection using C Programming |
|
|
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 |
|
 |
aravindks3 |
Posted: Tue Jun 20, 2017 10:20 pm Post subject: |
|
|
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 |
|
 |
hughson |
Posted: Tue Jun 20, 2017 11:09 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 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
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
aravindks3 |
Posted: Wed Jun 21, 2017 12:25 am Post subject: |
|
|
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 |
|
 |
exerk |
Posted: Wed Jun 21, 2017 1:18 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
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 |
|
 |
aravindks3 |
Posted: Wed Jun 21, 2017 6:11 pm Post subject: |
|
|
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 |
|
 |
|