IC SunsetThe developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this forum will no longer be available. More details available on our FAQ.
Topic
  • 5 replies
  • Latest Post - ‏2019-07-12T16:51:26Z by Nilesh_Shirke
SystemAdmin
SystemAdmin
8523 Posts

Pinned topic User/Password MQ Client when using C (Perl) API

‏2006-11-06T23:44:33Z |
I'm currently trying to connect to an MQ Queue Manager using the MQSeries API which permits the connection to MQ using PERL language. There is no way I can send the user and password information in the connection (CONNX) message.
Reading several forums and documentation I've found that new versions of MQ Clients (except for the Java one) sends the User ID of the process that is communicating with the Queue Manager.
I've tried to set the UserIndentifier and Password fields of the ClientConnection structure but there was no result and I'm still getting the 2035 (Not authorized) reason code.
Inspecting the code of the PERL MQSeries API I found that it uses a C-programmed shared library which uses the MQClient C API.
I cannot set the users on the server because I don't have access to MQ Server to configure them.
Is there a way to set a custom userID/password to send in CONNX command (overriding the UserID got from the operating system) either from MQSeries or from a ad-hoc C program?
Am I doing something wrong using the API?.
The server is running on AIX and the clients on Windows 2000 machines (will also run on AIX machines where put in production).

Could someone help me with this issue?.

Thanks in advance
Bruno
Updated on 2006-11-18T18:02:56Z at 2006-11-18T18:02:56Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    8523 Posts

    Re: User/Password MQ Client when using C (Perl) API

    ‏2006-11-07T11:31:02Z  
    bfontana2002@yahoo.com.ar wrote:
    > Could someone help me with this issue?.

    It sounds like you need to ask the maintainers of the Perl layer; it is
    not maintained by IBM.

    Regards,

    Phil Willoughby
    Software Engineer (Development)
    IBM WebSphere MQ
  • SystemAdmin
    SystemAdmin
    8523 Posts

    Re: User/Password MQ Client when using C (Perl) API

    ‏2006-11-07T12:41:17Z  
    bfontana2002@yahoo.com.ar wrote:
    > Could someone help me with this issue?.

    It sounds like you need to ask the maintainers of the Perl layer; it is
    not maintained by IBM.

    Regards,

    Phil Willoughby
    Software Engineer (Development)
    IBM WebSphere MQ
    I know that PERL layer is not mantained by IBM so I'll rewrite my question. Is possible, with C MQClient API, to send userID/Password in MQCONNX message overriding those obtained from the operating system?.

    Thanks again
    Bruno
  • SystemAdmin
    SystemAdmin
    8523 Posts

    Re: User/Password MQ Client when using C (Perl) API

    ‏2006-11-08T10:21:51Z  
    I know that PERL layer is not mantained by IBM so I'll rewrite my question. Is possible, with C MQClient API, to send userID/Password in MQCONNX message overriding those obtained from the operating system?.

    Thanks again
    Bruno
    bfontana2002@yahoo.com.ar wrote:
    > I know that PERL layer is not mantained by IBM so I'll rewrite my
    > question. Is possible, with C MQClient API, to send userID/Password
    > in MQCONNX message overriding those obtained from the operating
    > system?.

    Yes. The usual mistake people make is forgetting to set the Version
    field of the MQCNO structure to at least MQCNO_VERSION_2. The default
    if MQCNO_VERSION_1...

    Regards,

    Phil Willoughby
    Software Engineer (Development)
    IBM WebSphere MQ
  • SystemAdmin
    SystemAdmin
    8523 Posts

    Re: User/Password MQ Client when using C (Perl) API

    ‏2006-11-18T18:02:56Z  
    bfontana2002@yahoo.com.ar wrote:
    > I know that PERL layer is not mantained by IBM so I'll rewrite my
    > question. Is possible, with C MQClient API, to send userID/Password
    > in MQCONNX message overriding those obtained from the operating
    > system?.

    Yes. The usual mistake people make is forgetting to set the Version
    field of the MQCNO structure to at least MQCNO_VERSION_2. The default
    if MQCNO_VERSION_1...

    Regards,

    Phil Willoughby
    Software Engineer (Development)
    IBM WebSphere MQ
    Phil Willoughby wrote:
    > Yes. The usual mistake people make is forgetting to set the Version
    > field of the MQCNO structure to at least MQCNO_VERSION_2. The default
    > if MQCNO_VERSION_1...

    Oops, on reading the docs again it appears you need MQCNO_VERSION_5.

    Sorry for that error...

    Regards,

    Phil
  • Nilesh_Shirke
    Nilesh_Shirke
    1 Post

    Re: User/Password MQ Client when using C (Perl) API

    ‏2019-07-12T16:51:26Z  

    Hi Bruno, I was having the same issue with perl 5.10. I have used below code which did worked for me to test the connection from remote machine to MQServer.

    -----------

    #! /usr/bin/perl -w
    ################################################################################
    # Perl Pragma
    use 5.10.0;
    use strict;
    use warnings 'all';

    use MQSeries qw(:functions);
    use MQSeries::QueueManager;

    my $qmgr = MQSeries::QueueManager->new(
        QueueManager => '<QMGR_NAME>',
            ClientConn =>
                 {
            'ChannelName' => '<SVRCONN.CHANNEL>',
            'TransportType' => 'TCP',
            'ConnectionName' => '<MQ_SERVER_HOSTNAME(<MQ_PORT>)',},
                 SecurityParms => {
                        'AuthenticationType' => MQSeries::MQCSP_AUTH_USER_ID_AND_PWD,
                        'CSPUserId' => '<MQ_USERID>',
                        'CSPPassword' => '<MQ_USERID_PWD>',
                                   },);

    exit 0 unless defined $qmgr;

    print STDERR "Status\n";

    my $status = $qmgr->StatusInfo();

    use Data::Dumper;

    print Dumper(\$status);

    exit 0;

    __DATA__

     

     

    -----------------