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 » General Discussion » MQRC_NOT_AUTHORIZED

Post new topic  Reply to topic
 MQRC_NOT_AUTHORIZED « View previous topic :: View next topic » 
Author Message
saurabhsinha23
PostPosted: Wed Jun 16, 2004 4:07 am    Post subject: MQRC_NOT_AUTHORIZED Reply with quote

Novice

Joined: 20 Apr 2004
Posts: 12

I have written a small C code to connect to a queue manager and I am getting this error message.Any pointer to resolution of this error is appreciated.

CODE:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stddef.h>
#include <cmqc.h>

int main()
{

/* Variables for MQ calls */

MQHCONN Hconn;/*Connection handle */
MQLONG CompCode;/*Completion code */
MQLONG Reason;/*Qualifying reason */
MQCHAR qmgrname[4];

Hconn = 0;

/* Connect to the specified queue manager.*/
/* Test the output of the connect call.
/* If the call fails,print an error message showing the completion code and reason code,then leave the program.*/

MQCONN("MQSI",&Hconn,&CompCode,&Reason);
if ((CompCode !=MQCC_OK)|(Reason !=MQRC_NONE))
printf("Unable to connect to queue manager % d ", Reason);
else
printf("Connect successful");
return(0);
}

Thanks and regards,
Saurabh
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Jun 16, 2004 4:45 am    Post subject: Re: MQRC_NOT_AUTHORIZED Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

saurabhsinha23 wrote:
I have written a small C code to connect to a queue manager and I am getting this error message.

MQRC_NOT_AUTHORIZED is a security error.

It is nothing wrong with your code.

Search here for '2035' and see what the options for fixing it are.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
saurabhsinha23
PostPosted: Wed Jun 16, 2004 6:07 am    Post subject: Any paramter which is to be set for authorisation? Reply with quote

Novice

Joined: 20 Apr 2004
Posts: 12

Thanks for your reply.

This is the exact error message which I am getting.

MQCONN failed with CompCode:2, Reason:2035.

I understand that there is no problem with the program.Can you please tell me whether there is some parameter or attribute which is to be set.

Thanks and regards,
Saurabh
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Jun 16, 2004 6:20 am    Post subject: Re: Any paramter which is to be set for authorisation? Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

saurabhsinha23 wrote:
Can you please tell me whether there is some parameter or attribute which is to be set.


Can you please do as I asked, and use the search function for '2035'?

I promise you it will tell you everything you need to know. And I won't have to repeat what's already been said MANY MANY times.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
shogan2003
PostPosted: Fri Jun 18, 2004 1:04 am    Post subject: Reply with quote

Centurion

Joined: 03 Jul 2003
Posts: 133
Location: London

For client connection to server, if you're connecting using (e.g.) channel SYSTEM.DEF.SVRCONN then set its attribute MCAUSER to 'mqm'

i.e.

ALTER CHL(SYSTEM.DEF.SVRCONN) +
CHLTYPE(SVRCONN) +
MCAUSER('mqm')
_________________
MQSI2 certified specialist
MQSeries certified specialist
Back to top
View user's profile Send private message Send e-mail
saurabhsinha23
PostPosted: Fri Jun 18, 2004 1:14 am    Post subject: Reply with quote

Novice

Joined: 20 Apr 2004
Posts: 12

Thanks a lot!Yeah that did help.

Now I am getting an error code 2037.Any pointers to this?I am trying to browse a message in a queue..Following is the code.Also can anyone please tell me in which variable I will get the message.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stddef.h>
#include <cmqc.h>

#define BUFFERLENGTH 1000
int main()
{

/* Variables for MQ calls */

MQLONG OpenCompCode,OpenOptions;

/* variables for MQOPEN ******/
MQOD ObjDesc = { MQOD_DEFAULT };
MQHOBJ Hobj = 0;

MQHCONN Hconn;/*Connection handle */
MQLONG CompCode;/*Completion code */
MQLONG Reason;/*Qualifying reason */

MQCHAR qmgrname[15];
MQCHAR Queue[15];
Hconn = 0;
printf("Enter queue manager to which you want to connect? \n");
scanf("%s",&qmgrname);

/* Connect to the specified queue manager.*/
/* Test the output of the connect call.
/* If the call fails,print an error message showing the completion code and reason code,then leave the program.*/

MQCONN(qmgrname,&Hconn,&CompCode,&Reason);

if ((CompCode !=MQCC_OK)|(Reason !=MQRC_NONE))
printf("\n MQCONN failed with CompCode:%d, Reason:%d",CompCode,Reason);
else
printf("Connect successful");

/* Connect successful */
/* Read from the queue now */
printf("Enter the queue you want to browse\n");
scanf("%s",&Queue);
/* */
/* Set the options for the open call */
/* */
OpenOptions = MQOO_BROWSE;

/* @@@@ Use this for destructive read */
/* instead of the above. */
/* OpenOptions = MQOO_INPUT_SHARED; */
/* */

strcpy(ObjDesc.ObjectName,Queue);

MQOPEN(Hconn,
&ObjDesc,
OpenOptions,
&Hobj,
&OpenCompCode,
&Reason);

if (OpenCompCode != MQCC_OK)
printf("\n MQOPEN failed with CompCode:%d, Reason:%d",
OpenCompCode,Reason);

if (CompCode != MQCC_OK)
printf("\n failed with CompCode:%d, Reason:%d",
CompCode,Reason);
else
printf("Connect to queue successful");

/* Read from the queue */

MQMD MsgDesc ={MQMD_DEFAULT };
MQGMO GetMsgOpts = {MQGMO_DEFAULT };
MQCHAR Buffer [1001];
MQLONG DataLength ;
MQLONG BufferLength = BUFFERLENGTH;


MQGET(Hconn,
Hobj,
&MsgDesc,
&GetMsgOpts,
BufferLength,
Buffer,
&DataLength,
&CompCode,
&Reason);

printf("\n MQGET CompCode:%d, Reason:%d % s ",CompCode,Reason,MsgDesc);

// Disconnecting the queue manager.

printf("\n MQDISC");
MQDISC(&Hconn,
&CompCode,
&Reason);

return (OpenCompCode);

return(0);

}
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jun 18, 2004 3:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

shogan2003 wrote:
For client connection to server, if you're connecting using (e.g.) channel SYSTEM.DEF.SVRCONN then set its attribute MCAUSER to 'mqm'


This now means that anyone, and I mean ANYONE can connect to your queue manager with full authorities to do everything.

This is not necessarily a good idea.

saurabhsinha23 - all of the reason codes are listed in the documentation. Chapter 8 of the manual called 'Messages' contains an excellent listing of them.

From there, 2037 is
Quote:
2037 X'07F5' MQRC_NOT_OPEN_FOR_INPUT
An MQGET call was issued to retrieve a message from a queue, but the queue had not been opened for input.

Corrective action: Specify one of the following when the queue is opened:

MQOO_INPUT_SHARED
MQOO_INPUT_EXCLUSIVE
MQOO_INPUT_AS_Q_DEF


So please change your code appropriately.

And please please please start reading the manuals.
_________________
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 Page 1 of 1

MQSeries.net Forum Index » General Discussion » MQRC_NOT_AUTHORIZED
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.