|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Connecting Remote Queue using C langage- Error MQCONNX 2058 |
« View previous topic :: View next topic » |
Author |
Message
|
petiteri |
Posted: Mon Dec 04, 2006 9:39 am Post subject: Connecting Remote Queue using C langage- Error MQCONNX 2058 |
|
|
Newbie
Joined: 04 Dec 2006 Posts: 5
|
Hello all,
I have problem connecting a remote queue using the C langage.
Using the Java langage, i don't get any problem to connect this remote queue but using C, i get
always the same error with MQCONNX : the 2058 error which means that the queue does not exists.
When i want to connect to the local queue installed on my computer using my C code,
i don't get any problem, my code works well.
Maybe i forgot something in my code to connect a remote queue.
Maybe i need to specify the hostname and the port of the server on which
is my remote queue ?
Here are all the defintion of the queue manager i want to connect on :
Manager Name:QMIDTCC
Channel : Channel.TEST
hostname: mqm_test.emea.cib
port : 1948
I can ping the server. No problem of firewall.It works in java ....
I m using windows.
Please give me some help because i absolutely don't know why i can't connect htis remote queue .
Thanks a lot
Eric
PS:Here is the C code i m using to connect the queue :
/* Declare MQI structures needed */
MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */
/** note, sample uses defaults where it can **/
MQHCONN Hcon; /* connection handle */
MQHOBJ Hobj; /* object handle */
MQLONG O_options; /* MQOPEN options */
MQLONG C_options; /* MQCLOSE options */
MQLONG CompCode; /* completion code */
MQLONG OpenCode; /* MQOPEN completion code */
MQLONG Reason; /* reason code */
MQLONG CReason; /* reason code for MQCONN */
MQLONG buflen; /* buffer length */
int buffersize;
MQCHAR48 qmgrName; /* Name of queue manager */
MQCNO mqcno = {MQCNO_DEFAULT} ; /* Connection options */
MQCD mqcd = {MQCD_CLIENT_CONN_DEFAULT}; /* Channel Defs */
/******************************************************************/
/* */
/* Connect to queue manager */
/* */
/******************************************************************/
_putenv("MQSERVER=SYSTEM.ADMIN.SVRCONN/TCP/mqm_int.int.cm.par.emea.cib(1414)");
_putenv("MQ_USER_ID=P0272100");
_putenv("MQ_PASSWORD=TESTPSSWD");
strncpy(mqcd.ConnectionName,
"mqm_int.int.cm.par.emea.cib",
MQ_CONN_NAME_LENGTH);
strncpy(mqcd.UserIdentifier,
"P0272100",
;
strncpy(mqcd.Password ,
"TESTPSSWD",
;
strncpy(mqcd.ChannelName,
"CH.DTCC",
MQ_CHANNEL_NAME_LENGTH);
mqcno.ClientConnPtr = &mqcd;
MQCONNX("QMIDTCC",
&mqcno,
&Hcon,
&CompCode,
&CReason);
printf("MQCONN ended with cc %ld rc %ld\n", CompCode, CReason);
/* report reason and stop if it failed */
if (CompCode == MQCC_FAILED)
{
exit( (int)CReason );
}
/******************************************************************/
/* */
/* Use parameter as the name of the target queue */
/* */
/******************************************************************/
strncpy(od.ObjectName, "QA.DTCCSEND", (size_t)MQ_Q_NAME_LENGTH);
strncpy(od.ObjectQMgrName, "QMIDTCC", (size_t)MQ_Q_MGR_NAME_LENGTH);
printf("Target queue is %s\n", od.ObjectName);
/******************************************************************/
/* */
/* Open the target message queue for output */
/* */
/******************************************************************/
O_options = MQOO_OUTPUT /* open queue for output */
+ MQOO_SET_IDENTITY_CONTEXT;
MQOPEN(Hcon, /* connection handle */
&od, /* object descriptor for queue */
O_options, /* open options */
&Hobj, /* object handle */
&OpenCode, /* MQOPEN completion code */
&Reason); /* reason code */
/* report reason, if any; stop if failed */
printf("MQOPEN ended with reason code %ld\n", Reason);
if (OpenCode == MQCC_FAILED)
{
printf("unable to open queue for output\n");
exit( (int)Reason );
}
|
|
Back to top |
|
 |
tleichen |
Posted: Mon Dec 04, 2006 2:03 pm Post subject: Re: Connecting Remote Queue using C langage- Error MQCONNX 2 |
|
|
Yatiri
Joined: 11 Apr 2005 Posts: 663 Location: Center of the USA
|
petiteri wrote: |
Hello all,
I have problem connecting a remote queue using the C langage.
Using the Java langage, i don't get any problem to connect this remote queue but using C, i get
always the same error with MQCONNX : the 2058 error which means that the queue does not exists.
...
|
A 2058 error means that the queue manager name does not exist, not the queue name...  _________________ IBM Certified MQSeries Specialist
IBM Certified MQSeries Developer |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Dec 04, 2006 2:15 pm Post subject: Re: Connecting Remote Queue using C langage- Error MQCONNX 2 |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
tleichen wrote: |
A 2058 error means that the queue manager name does not exist, not the queue name...  |
To be a little more precise, it means that the name that was given was not the name of the queue manager that was CONNECTED to.
So, for example, if you have two queue managers QMA and QMB on different ports and you try to connect to QMA on the port for QMB, you'll get a 2058. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
petiteri |
Posted: Tue Dec 05, 2006 1:08 am Post subject: Connecting Remote Queue using C langage- Error MQCONNX 2058 |
|
|
Newbie
Joined: 04 Dec 2006 Posts: 5
|
Thanks for your reply.
But what i dont' understand is that works with java but not with C.
So maybe i forgot something in my code to connect the good queue manager.
I did not find any C function which allowws me to define the port of the QM i want to connect.
Could you tell me how i can do to define the port of my QM.
I m using the MQCD structure to define the qmgrName, the channel name
strncpy(mqcd.ChannelName,
"CH.DTCC",
MQ_CHANNEL_NAME_LENGTH);
strncpy( mqcd.QMgrName , "QMIDTCC" , MQ_Q_MGR_NAME_LENGTH) ;
I put those values inside the mqcno.ClientConnPtr :mqcno.ClientConnPtr = &mqcd;
and after that i m using MQCONNX("QMIDTCC",
&mqcno,
&Hcon,
&CompCode,
&CReason);
But it does not work.And when i am trying to connect to this QM in Java, everything works well....
Please give me some help. Maybe i need to define this remote queue in the registry values of windows ? To I need to configure this queue somewhere on the client computer ???? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Dec 05, 2006 1:14 am Post subject: Re: Connecting Remote Queue using C langage- Error MQCONNX 2 |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
petiteri wrote: |
I m using the MQCD structure to define the qmgrName, the channel name
strncpy(mqcd.ChannelName,
"CH.DTCC",
MQ_CHANNEL_NAME_LENGTH);
strncpy( mqcd.QMgrName , "QMIDTCC" , MQ_Q_MGR_NAME_LENGTH) ;
I put those values inside the mqcno.ClientConnPtr :mqcno.ClientConnPtr = &mqcd;
|
At the top of this post you name the channel as "Channel.TEST". Typo?
All you should need is the channel definition to connect to the queue manager via the client. Make sure also the channel table is correctly identified by the environment variables as per the Clients manual.
You don't need to define the queue mane locally and don't be messing round in the registry! _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
petiteri |
Posted: Tue Dec 05, 2006 1:49 am Post subject: |
|
|
Newbie
Joined: 04 Dec 2006 Posts: 5
|
Thanks for your answer !
The Channel name in fact is CH.DTCC.
What is the channel table ? Is that something on the server side or on the client side ?
what is the channel defintion for you ? the name,the port ?
The channel table must be well configured because in java everything works well ... Don't we use the channel table in java ?
Sorry for those questions but i m relly new in MqSeries in C.
Thanks
eric |
|
Back to top |
|
 |
queuemanager |
Posted: Tue Dec 05, 2006 1:50 am Post subject: |
|
|
Apprentice
Joined: 28 Nov 2006 Posts: 43 Location: Bangalore
|
Hey, correct me if i'm wrong but while connecting through a client, MQSERVER takes precedence over channel table. Now in ur code, u r using putenv to set MQSERVER .....
_putenv("MQSERVER=SYSTEM.ADMIN.SVRCONN/TCP/mqm_int.int.cm.par.emea.cib(1414)");
So, ur application is tring to connect to "mqm_int.int.cm.par.emea.cib" host from 1414 port. Please check that u have ur listner running on 1414 for this queuemanager. Also the channel used for making the connection will be "SYSTEM.ADMIN.SVRCONN" not "CH.DTCC". |
|
Back to top |
|
 |
Vitor |
Posted: Tue Dec 05, 2006 2:00 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
I thought it went the other way round, but didn't spot the "putenv" in the code....
You should use one method or the other, not both. Specifying the MQCD structure as you are implies you're trying to connect via a channel table held locally. This is the "other" method to the MQSERVER variable and is perfectly valid. Both methods have advantages & disadvantages so it's a design choice which to go for.
I have no idea about client tables in Java - I'm not a Java person. With luck, others better versed will respond. I had heard there were issues below v5.3 & the configuration was different so most Java uses MQEnvironment to set the variable but again it's not my thing.
Check out the Clients manual. It describes all these methods in detail, with instructions on how to define the table locally. Failing that, set MQSERVER to the values you want and use MQCONN & no MQCD.
Note that once the channel table is defined you don't need to use MQCD structure - the client will find the details automatically based on the MQCONN call. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Dec 05, 2006 2:42 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I'm fairly sure that the use of MQCONNX means that all environment variables will be ignored - both the client channel ones and MQSERVER.
It does queuemanager no good to specify a password in this code, either, I think.
Reading the code, it looks like it is attempting to connect to the equivalent of an MQServer value of "CH_DTCC/TCP/mqm_int.init.cm.parm.emea.cib". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wschutz |
Posted: Tue Dec 05, 2006 4:03 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Changing the environment from within the "c" program does not work (at least in my experience, so your _putenv calls do nothing).
And yes, the environment variables are overridden by a MQCD being passed on the MQCONNX call,, but you need to specify:
mqcno.Version = MQCNO_VERSION_2: /* or greater */ for the CD structure to be recognized... _________________ -wayne |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|