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 Java / JMS » 2 phase commit with MQ BaseJava on Linux

Post new topic  Reply to topic
 2 phase commit with MQ BaseJava on Linux « View previous topic :: View next topic » 
Author Message
murali_bestha
PostPosted: Mon Mar 15, 2004 5:54 pm    Post subject: 2 phase commit with MQ BaseJava on Linux Reply with quote

Novice

Joined: 12 Feb 2004
Posts: 17

Hi,

Please help me. If anybody has implemented the on Linux i86 platform with WebSphere Base MQ Java. Our environment is as follows:


WebSphere MQ Server : Linux 2.4.18-14 (intel based)
Oracle Server : Oracle 9i
JRE : 1.3.1_10


I have created the oraswit swtich file and placed in appropriate folder. Alos the necessay grants are given on the DB server for the Oracle user. Successully started the Queue Manager with the Oracle XA Resource registered in the qm.ini. But when I run my application this gives in MQ error 2121 (MQRC_NO_EXTERNAL_PARTICIPANTS).

Code:


      Connection conn = null;
      PreparedStatement pStmnt = null;
      MQQueue queue = null;
      try {
         MQEnvironment.CCSID = 932;
         MQEnvironment.hostname = "";
         MQEnvironment.channel  = "";
         MQEnvironment.port = 0;

         Hashtable envProperties = new Hashtable();
         envProperties.put(MQC.THREAD_AFFINITY, new Boolean(true));
         envProperties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_BINDINGS);

         // Create a connection to the queue manager
         qMgr = new MQQueueManager(qManager, envProperties);

         int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE;

         queue = qMgr.accessQueue(qName, openOptions);

         MQMessage retrievedMessage = new MQMessage();

         MQGetMessageOptions gmo = new MQGetMessageOptions();
         gmo.options = MQC.MQGMO_NO_WAIT | MQC.MQGMO_ACCEPT_TRUNCATED_MSG | MQC.MQGMO_FAIL_IF_QUIESCING;          gmo.options =  gmo.options | MQC.MQGMO_SYNCPOINT;

         OracleXADataSource ds = new OracleXADataSource();
         ds.setUser("scott");
         ds.setPassword("tiger");
         ds.setURL("jdbc:oracle:thin:@111.11.11.11:1521:test");
         conn = qMgr.getJDBCConnection( (javax.sql.XADataSource)ds );

         System.out.println("conn is : " + conn);

         qMgr.begin();
         
         pStmnt = conn.prepareStatement("update atm set cash = 200 where id='murali'");
         int iUpdateCount = pStmnt.executeUpdate();
         if( iUpdateCount <= 0 )
         {
            qMgr.backout();
            throw new Exception("No records are updated for murali ");
         }
         queue.get(retrievedMessage, gmo);
         String msgText = retrievedMessage.readUTF();

         System.out.println("Reading UTF The message is: " + msgText);

         qMgr.commit();
      }
      catch (MQException ex)
      {
         try{
            if( qMgr != null )
               qMgr.backout();
         }
         catch (MQException ex1)
         {
         }

         ex.printStackTrace(System.out);
         System.out.println("A WebSphere MQ error occurred : Completion code " + ex.completionCode + " Reason code " + ex.reasonCode);
      }
      catch (java.io.IOException ex)
      {
         try{
            if( qMgr != null )
               qMgr.backout();
         }
         catch (MQException ex1)
         {
         }
         ex.printStackTrace(System.out);
         System.out.println("An error occurred whilst writing to the message buffer: " + ex);
      }
      catch (Exception ex)
      {
         try{
            if( qMgr != null )
               qMgr.backout();
         }
         catch (MQException ex1)
         {
         }
         ex.printStackTrace(System.out);
         System.out.println("An exception: " + ex);
      }
      finally
      {
         try
         {
            if( pStmnt != null )
               pStmnt.close();
            if( conn != null )
               conn.close();
            if( queue != null )
               queue.close();
            if( qMgr != null )
            {
               qMgr.disconnect();
               qMgr.close();
            }
         }
         catch(Exception ex)
         {
            ex.printStackTrace();
            System.out.println("Exception occurred in finally ");
         }
      }



Exception is occuring at the qMgr.begin() statement. Can anybody please let me know if 2 phase commit on this version of of Linux is supported? Or is there any other setting/coding I am missing?

Thanks and Regards
Murali
Back to top
View user's profile Send private message Yahoo Messenger
murali_bestha
PostPosted: Thu Mar 18, 2004 9:29 pm    Post subject: Reply with quote

Novice

Joined: 12 Feb 2004
Posts: 17

Hi All,

Finally we found that the 2 phase commit is not supported in WebSphere MQ on Linux.

Regards
Murali
Back to top
View user's profile Send private message Yahoo Messenger
bower5932
PostPosted: Fri Mar 19, 2004 6:52 am    Post subject: Reply with quote

Jedi Knight

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

Where did you find this out?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
murali_bestha
PostPosted: Fri Mar 19, 2004 6:39 pm    Post subject: Reply with quote

Novice

Joined: 12 Feb 2004
Posts: 17

On the MQSeries Base Java document ( a PDF file bundled along with the installable).
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » 2 phase commit with MQ BaseJava on Linux
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.