question

SrinivasNalla-9071 avatar image
0 Votes"
SrinivasNalla-9071 asked SrinivasNalla-9071 commented

Unable to connect to IBM MQ from C# console application with credentials

Hi,
I am unable to connect to IBM MQ from C# console application with credentials. Here is the code. Its throwing "2035 Not Authorized" error.

protected MQQueueManager mqQueueManager;

public override void Open() {
Hashtable properties = new Hashtable();
properties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);
properties.Add(MQC.HOST_NAME_PROPERTY, mq_hostName);
properties.Add(MQC.CHANNEL_PROPERTY, mq_channel);
properties.Add(MQC.PORT_PROPERTY, mq_port);
properties.Add(MQC.USER_ID_PROPERTY, mq_userName);
properties.Add(MQC.PASSWORD_PROPERTY, mq_password);
properties.Add(MQC.USE_MQCSP_AUTHENTICATION_PROPERTY, true);

try {
mqQueueManager = new MQQueueManager(mq_queueManagerName, properties);
Console.WriteLine("Connected to MQ");
}
catch (MQException e) {
log.Fatal("MQ Queue Manager creation Error", e);
throw e;
}
}

What I have tried:

If I comment user name and password properties. It’s able to connect. Not sure, why it’s not working with credentials. Please let me know if anyone has encountered this issue and any pointers to resolve the same. Thanks in advance!

Thanks
-Srini

dotnet-csharp
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@SrinivasNalla-9071
lthough this code is written in C#, the key question is how to connect to IBM MQ with credentials.
IBM MQ is a third-party product, and many members here may not have experience in using it. I suggest you go to the forum provided by IBM to ask your questions for better support.

0 Votes 0 ·

Thanks for your redirecting to relevant groups!

0 Votes 0 ·

1 Answer

SrinivasNalla-9071 avatar image
0 Votes"
SrinivasNalla-9071 answered

Its an issue with user name. We are migrating Java application to .NET and in user name "@domain" was there at the end. Looks like, this format is required for Java and its working fine there. When we use same user name in .NET, it was not working and throwing error "2035 MQRC_NOT_AUTHORIZED". Once we removed @domain from it, it started working.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.