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 » JRE Version for QueueManager's getJDBCConnection for 2PC

Post new topic  Reply to topic
 JRE Version for QueueManager's getJDBCConnection for 2PC « View previous topic :: View next topic » 
Author Message
murali_bestha
PostPosted: Mon Mar 08, 2004 6:57 pm    Post subject: JRE Version for QueueManager's getJDBCConnection for 2PC Reply with quote

Novice

Joined: 12 Feb 2004
Posts: 17

Hi,

We have the following environment:

DB : Oracle9i on Solaris
Websphere MQ : on Windows 2K
JRE : 1.3.1_10
JDBC Driver : classes12.jar from Oracle

In a standalone java application, we are trying to update a DB and put a message to a queue. This needs to be done under a transaction for a 2 phase commit.

In MqBaseJavaTest.java

<CODE>
PreparedStatement pStmnt = null;
MQQueue queue = null;
//Create a connection to the queue manager
java.util.Hashtable properties = new Hashtable();
properties.put(MQC.THREAD_AFFINITY, new Boolean(true));
qMgr =new MQQueueManager(strQMgrName, properties);
OracleXADataSource ds = new OracleXADataSource();
ds.setUser("scott");
ds.setPassword("tiger");
ds.setURL("jdbc:oracle:thin:@192.111.11.111:1521:test");
conn = qMgr.getJDBCConnection( (javax.sql.XADataSource)ds );

qMgr.begin();
pStmnt = conn.prepareStatement("update atm set cash = " + iValue + " where id='" + strUserId + "'");
int iUpdateCount = pStmnt.executeUpdate();
if( iUpdateCount <= 0 )
{
qMgr.backout;
throw new Exception("No records are updated for " + strUserId );
}
// Set up the options on the queue we wish to open...
int openOption = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE;
// Now specify the queue that we wish to open, and the open options...
queue = qMgr.accessQueue("BANKQUEUE2",openOption,strQMgrName,strQMgrName,"");
// Define a simple MQSeries message, and write some text in UTF format..
MQMessage putMessage = new MQMessage();
putMessage.priority = 5;
putMessage.characterSet = 943;
putMessage.writeUTF("Hello World!");
MQPutMessageOptions mqpmo = new MQPutMessageOptions();
mqpmo.options = MQC.MQPMO_SYNCPOINT;
queue.put(putMessage, mqpmo);
qMgr.commit();
iValue++;
</CODE>

When we try to run this class. the following exception is occurring:


java.lang.ArrayIndexOutOfBoundsException
at oracle.security.o3logon.C1.r(C1)
at oracle.security.o3logon.C1.l(C1)
at oracle.security.o3logon.C0.c(C0)
at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientH
elper)
at oracle.jdbc.ttc7.O3log.<init>(O3log.java:291)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:257)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:287)

at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:442)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:172)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java
:116)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection
(OracleConnectionPoolDataSource.java:107)
at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXAData
Source.java:211)
at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXAData
Source.java:84)
at com.ibm.mq.XAtoJTA.helpGetConnection(XAtoJTA.java:395)
at com.ibm.mq.MQQueueManager.getJDBCConnection(MQQueueManager.java:242)
at com.ibm.mq.MQQueueManager.getJDBCConnection(MQQueueManager.java:199)
at MqBaseJavaTest.doProcess(MqBaseJavaTest.java:8
at MqBaseJavaTest.main(MqBaseJavaTest.java:202)

Looks like the transactions in MQ cannot be done in Java 1.3.1. Do we need to use Java 1.4 version?

Please let us know asap as this is very urgent for us.

Thanks and Regards
Murali
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Mon Mar 08, 2004 7:15 pm    Post subject: Re: JRE Version for QueueManager's getJDBCConnection for 2PC Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

murali_bestha wrote:

When we try to run this class. the following exception is occurring: java.lang.ArrayIndexOutOfBoundsException
at oracle.security.o3logon.C1.r(C1)
at oracle.security.o3logon.C1.l(C1)
at oracle.security.o3logon.C0.c(C0)
at

Looks like the transactions in MQ cannot be done in Java 1.3.1. Do we need to use Java 1.4 version?


I don't think that changing the version of Java that you're running with will fix an Array Index Out of Bounds error. Unless you have some Oracle specific documentation that says that there is a compatibility issue between the version of the Oracle security classes you are running and the java.lang.array class included in Java 1.3.1.

I'd try looking at your XA configuration again. And make sure that you're running your code on the same machine as your queue manager.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
murali_bestha
PostPosted: Mon Mar 08, 2004 7:20 pm    Post subject: Reply with quote

Novice

Joined: 12 Feb 2004
Posts: 17

Hi jefflowrey,

The WebSphere MQ base Java documentation says like this:

WebSphere MQ base Java supports the MQQueueManager.begin() method, which allows WebSphere MQ to act as a coordinator for a database which provides a JDBC 2 compliant driver. Currently this support is available on Solaris, AIX, and Windows systems with Oracle or DB2 databases.

So, as u said, the JRE version should not be a problem. We are using WebSphere MQ 5.3 and classes12.jar which are JDBC2.0 compliant. Becasue our database is Oracle9i, we are using the jdbcora9.dll as the switch DLL. This jdbcora9.dll is available from the CSD06 (lastest Fix pack6). Would this be a problem if we use jdbcora9.dll with JRE1.3?

Thanks and Regards
Murali
Back to top
View user's profile Send private message Yahoo Messenger
murali_bestha
PostPosted: Tue Mar 09, 2004 8:44 pm    Post subject: Reply with quote

Novice

Joined: 12 Feb 2004
Posts: 17

Hi

Found the solutions. The problem was with the JDBC drivers. We have downloaded the latest classes12.zip available on the Oracle website and its working fine.

Thanks and Regards
Murali
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 » JRE Version for QueueManager's getJDBCConnection for 2PC
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.