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 » IBM MQ API Support » .NET Client Connection Problems

Post new topic  Reply to topic
 .NET Client Connection Problems « View previous topic :: View next topic » 
Author Message
jigjim
PostPosted: Wed Dec 08, 2004 12:13 pm    Post subject: .NET Client Connection Problems Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,

I am using Mq series 5.3 and doing a .NET Client connection to read messages from a Q. We have three MQ Series server running on Z/OS. I am able to do it succesfully for two of them. For the third I face the following problem.

With this code:
Code:
         
try
{
   mqQMgr = new MQQueueManager(QMgr);   
   mqQueue = mqQMgr.AccessQueue(QName, MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_INQUIRE);   
            
   MQMessage            mqMsg;           // MQMessage instance
   MQGetMessageOptions mqGetMsgOpts;    // MQGetMessageOptions instance
   string msg;
   while (true)
  {
      msg = "";
      mqMsg = new MQMessage();
      mqGetMsgOpts = new MQGetMessageOptions();
      mqGetMsgOpts.WaitInterval = 10;
      mqGetMsgOpts.Options = MQC.MQGMO_SYNCPOINT;
      mqQueue.Get(mqMsg, mqGetMsgOpts );
      msg = mqMsg.ReadString(mqMsg.MessageLength);
   }
   if (LogMessageToSQL(guid, msg, QMgr, 0, 1))
   {
      mqQMgr.Commit();
   }
   else
   {
      mqQMgr.Backout();
      throw new System.ApplicationException("LogMessageToSQlDBFailed");
    }
}
catch (MQException mqe)
{
    if ( mqe.Reason == MQC.MQRC_NO_MSG_AVAILABLE )    
   {
       Thread.Sleep(sTime);
    }
    else
    {
       Thread.CurrentThread.Abort();
     }
}
catch (Exception e)
{         
   Thread.CurrentThread.Abort();
}


This gives me a 2035 Error. User access problem.. I checked the MQ logs and .NET was trying to connect using a USER(SYSTEM) id.

So I changed my user id by using the following code:

Code:

try
{
   mqQMgr = new MQQueueManager(QMgr);   
   mqQueue = mqQMgr.AccessQueue(QName, MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_SET_IDENTITY_CONTEXT);   
            
   MQMessage            mqMsg;           // MQMessage instance
   MQGetMessageOptions mqGetMsgOpts;    // MQGetMessageOptions instance
   string msg;
   while (true)
  {
      msg = "";
      mqMsg = new MQMessage();
      mqMsg.UserId = "NEWID";  // Fictitious ID :)
      mqGetMsgOpts = new MQGetMessageOptions();
      mqGetMsgOpts.WaitInterval = 10;
      mqGetMsgOpts.Options = MQC.MQGMO_SYNCPOINT;
      mqQueue.Get(mqMsg, mqGetMsgOpts );
      msg = mqMsg.ReadString(mqMsg.MessageLength);
   }
   if (LogMessageToSQL(guid, msg, QMgr, 0, 1))
   {
      mqQMgr.Commit();
   }
   else
   {
      mqQMgr.Backout();
      throw new System.ApplicationException("LogMessageToSQlDBFailed");
    }
}
catch (MQException mqe)
{
    if ( mqe.Reason == MQC.MQRC_NO_MSG_AVAILABLE )    
   {
       Thread.Sleep(sTime);
    }
    else
    {
       Thread.CurrentThread.Abort();
     }
}
catch (Exception e)
{         
   Thread.CurrentThread.Abort();
}


This gave me a 2046 Error. MQRC_OPTIONS_ERROR. I dont see anything on my MQLog for this. Does this mean that:
1. I failed because of the Options Error before I even tried to access the mainframe
2. Or that I was able to access the Q but because of invalid options I was not able to Read.

Can somebody pls help me on how to set the ID with the correct options so that I can read the messages correctly.

Thanks

Jigs
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Dec 08, 2004 12:31 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The user ID that's being validated isn't set on the MQMessage.

It's set on the connection.

So by the time you get to the statement that either is wrong (and gives you a 2046) or tries to do something the user isn't authorized to (and gives you a 2035), it's too late to change the user.

Look at the documentation of the constructors for MQQueueManager, or look for .NET versions of the MQCONNX call.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Wed Dec 08, 2004 12:48 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Thanks for setting me with the start point.
Can you pls guide me to where i can find these documentations ?

Thanks

Jigs
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Dec 08, 2004 2:03 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Look under the 'documentation' at the top of this page. You want the 'Library Home Page'.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
kirani
PostPosted: Wed Dec 08, 2004 3:49 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

And here ..
http://www.mqseries.net/phpBB2/viewtopic.php?t=18349
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
jigjim
PostPosted: Thu Dec 09, 2004 2:04 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,
I tried several scenarios But am failing to do a .NET Client connect to a MQ Serier Server Running on z/OS. When I am logged in as Administrator, it connects as:
Quote:

TC08562 IRR012I VERIFICATION FAILED. USER PROFILE NOT FOUND
TC08562 ICH408I USER(ADMINIST) GROUP( ) NAME


I want to overide that USER(ADMINIST) with a user id I set in code. Is it possible ?

Here is a snippet of the code i tried:
Code:

MQEnvironment.Hostname = QMgr;
MQEnvironment.Channel = "TO." + QMgr + ".SOP.00";
MQEnvironment.Port = Qport;
      
MQQueueManager mqQMgr = null;
MQQueue        mqQueue = null;

try
{
   mqQMgr = new MQQueueManager(QMgr);   
   mqQMgr.AlternateUserId = "bc8ktw3";
   Console.WriteLine("Connected to Qmgr:"+mqQMgr.Name.Trim());
   // Works good till here
  mqQueue = mqQMgr.AccessQueue(QName, MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_ALTERNATE_USER_AUTHORITY,QMgr,null,"bc8ktw3");     
   // but not if MQM stopping
   // THROWS a 2035 Exception here.
   Console.WriteLine("Connected to Qname:"+mqQueue.Name.Trim());
}
catch (MQException mqe)
{
   Console.WriteLine("QMgr/QName exception:"+mqe.Message);
   Thread.CurrentThread.Abort();
}


Any help is appreciated. I have to do a proof of concept Tomm/Monday latest.

Thanks

jigs
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 » IBM MQ API Support » .NET Client Connection Problems
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.