|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQRC_NO_EXTERNAL_PARTICIPANTS |
« View previous topic :: View next topic » |
Author |
Message
|
vedantpatil |
Posted: Thu Mar 10, 2005 3:55 am Post subject: MQRC_NO_EXTERNAL_PARTICIPANTS |
|
|
Novice
Joined: 10 Mar 2005 Posts: 19
|
I am trying to do 2- phase commit. I used the code given in this site(given below). and all the steps are performed. The error I am getting is 2121 MQRC_NO_EXTERNAL_PARTICIPANTS .
What could have gone wrong.
I have created switch file and done XA resource manager settings.
------------------------------------------------------------------------------
public class mqdb2log {
private MQQueueManager qMgr;
private String qmgrName;
private String queueName;
private String dbName;
private Connection jdbcConn;
public static void main (String args[]) {
mqdb2log mySample = new mqdb2log(args);
mySample.start();
}
/**********************************************************/
/* This program doesn't have any specific initialization. */
/* If it did, it could go here. */
/**********************************************************/
public void init() {
}
public void start() {
try {
System.out.println("mqdb2log started...");
/******************************************************/
/* Create a queue manager object and access the queue */
/* that will be used for the putting of messages. */
/******************************************************/
qMgr = new MQQueueManager("QM");
int openOptions = MQC.MQOO_OUTPUT;
MQQueue myQueue = qMgr.accessQueue("LQ1", openOptions,
null, null, null);
/******************************************************/
/* Create a DB2 XA DataSource that we will use as the */
/* place to perform database updates. */
/******************************************************/
/* COM.ibm.db2.jdbc.DB2XADataSource myDataSource =
new COM.ibm.db2.jdbc.DB2XADataSource();*/
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
oracle.jdbc.xa.client.OracleXADataSource myDataSource =
new oracle.jdbc.xa.client.OracleXADataSource();
myDataSource.setUser("DB2Admin");
myDataSource.setPassword("pass");
myDataSource.setURL("jdbc:oracle:thin:@asdf:1521:"+"str");
// DriverManager.getConnection("aliaswire","db2admin","Password1");
jdbcConn = qMgr.getJDBCConnection(myDataSource);
//myDataSource.setDatabaseName(dbName);
//jdbcConn = qMgr.getJDBCConnection(myDataSource);
/*****************************************/
/* Set up a reader to get the user input */
/*****************************************/
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String runShow;
System.out.println("mqdb2log ready for db command");
/********************************************/
/* As long as the user keeps entering data, */
/* process it... */
/********************************************/
do {
runShow = br.readLine();
/************************************/
/* See if the user entered anything */
/************************************/
if (runShow.length() > 0) {
qMgr.begin();
/****************************************************/
/* Set up a new message with a format of string and */
/* write the user input to it. */
/****************************************************/
MQMessage myMessage = new MQMessage();
myMessage.writeString(runShow);
myMessage.format = MQC.MQFMT_STRING;
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = pmo.options | MQC.MQPMO_SYNCPOINT;
myQueue.put(myMessage, pmo);
boolean validStatement = true;
Statement stmt = jdbcConn.createStatement();
try {
int rowsUpdated = stmt.executeUpdate(runShow);
System.out.println("Rows updated: " + rowsUpdated);
} catch (java.lang.Exception ex) {
validStatement = false;
System.out.println("Java exception: " + ex);
System.out.println(" mqdb2log is designed to work only with update statements.\n");
}
stmt.close();
/*************************************************************/
/* Ask if the db update, message put should be committed or */
/* backed out (if db command was valid). If the command */
/* wasn't valid, we'll backout the qmgr update. */
/*************************************************************/
if (validStatement) {
System.out.println("Enter C to Commit or R to rollback");
runShow = br.readLine();
if ( (runShow.indexOf("c") >= 0)
|| (runShow.indexOf("C") >= 0) ) {
qMgr.commit();
} else {
qMgr.backout();
}
} else {
qMgr.backout();
}
}
System.out.println("mqdb2log ready for db command");
} while (runShow.length() > 0) ;
/**********************************************************/
/* Before the program ends, we need to close all of our */
/* connections. */
/**********************************************************/
myQueue.close();
jdbcConn.close();
qMgr.disconnect();
}
catch (MQException ex) {
System.out.println("An MQ error occurred: " + ex.completionCode + " " +
ex.reasonCode);
}
catch (java.io.IOException ex) {
System.out.println("Java.io exception: " + ex);
}
catch (java.lang.Exception ex) {
System.out.println("Java exception: " + ex);
}
System.out.println("mqdb2log finished...");
}
}
--------------
Thanks in advance |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Mar 10, 2005 8:46 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
My guess would be that there is nothing wrong with the code but that there is something wrong with the setup. There are several comments in the prologue of the original source that discuss some of the setup that needs to be done. Have you done all of these? Specifically, the part about setting up the switchfile.
Also, what version of WMQ are you using and on what operating system? |
|
Back to top |
|
 |
vedantpatil |
Posted: Thu Mar 10, 2005 9:52 pm Post subject: |
|
|
Novice
Joined: 10 Mar 2005 Posts: 19
|
These are the settings i have done in XA Resourse box
SwitchFile=C:\Program Files\IBM\WebSphere MQ\bin\ORASWIT.dll
XAOpenString=ORACLE_XA+ACC=P/db2admin/Password1+sestm=0+SqlNet=DSNNAME+DB=ORACLEDB
ThereadOFControl = THREAD
I am using Websphere MQ version 5.3, operating system Windows 2000 professional. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|