4

How to I specify the username and password in a wmq connection string? This is the sample connection string I'm working with.

        Uri sampleAddress = new Uri("wmq://localhost:1414/msg/queue/Q1?connectQueueManager=QM1&replyTo=Q2");

How do I put the userId/password used for authentication to the MQ Manager here?

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
Paul Fryer
  • 9,268
  • 14
  • 61
  • 93

1 Answers1

3

For V8.0 I was successful by making the connection in the following way:

Hashtable connectionProperties = new Hashtable();                             
connectionProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);
connectionProperties.Add(MQC.HOST_NAME_PROPERTY, _queueServer);
connectionProperties.Add(MQC.PORT_PROPERTY, _portNumber);
connectionProperties.Add(MQC.CHANNEL_PROPERTY, _channelInfo);
connectionProperties.Add(MQC.USER_ID_PROPERTY, "userid");
connectionProperties.Add(MQC.PASSWORD_PROPERTY, "password");                    
queueManager = new MQQueueManager(_queueManager, connectionProperties);

See here. Although for version below 8.0 please see that you will have to use an exit mechanism as for them the client provided id is not used.

Syed Osama Maruf
  • 1,895
  • 2
  • 20
  • 37