views:

254

answers:

2

I need to connect to two Oracle AQ queues in different databases. I'm using exactly similar code in both cases, except for the connection string of course. One of the queues is working fine, but the second one not.

String db_string = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=x.y.z.2)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=x.y.z.3)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=DBNAME)))";

String name = "scott";
String pwd = "tiger";

Properties info = new Properties();
info.put("name", name);
info.put("password", pwd);

QueueConnectionFactory q_cf = AQjmsFactory.getQueueConnectionFactory(db_string, info);
QueueConnection q_conn q_conn = q_cf.createQueueConnection(name, pwd);

QueueSession q_sess = q_conn.createQueueSession(true, Session.CLIENT_ACKNOWLEDGE);
q_conn.start();
Queue queue = ((AQjmsSession) q_sess).getQueue("test","myaq");
((AQjmsDestination) queue).start(q_sess, true, true);
QueueReceiver q_recvr = q_sess.createReceiver(queue);
TextMessage message = (TextMessage) q_recvr.receive();

System.out.println(message.getText());

When I use the code to connect to the AQ which works fine, it correctly prints the text included in the message. The second AQ prints just three quotation marks, regardless of what the message contains.

I'm using aqapi 10.2.0.2 and I've tested with both ojdbc14 10.2.0.2.0 and ojdbc5 11.1.0.6.0. AQ which is working is running on Oracle 11.1.0.0.0, and the one which is causing the issues on 10.2.0.4.0. I've analyzed the TNS packets with Wireshark, and packets containing the AQ messages look pretty much similar with both databases.

Reflection dump of TextMessage object of the working case looks like this:

{text_data=MY_TEXT_MESSAGEtext_msg_cont=oracle.jms.AQjmsTextMessage_C@1a7508agen_msg_cont=oracle.jms.AQjmsGenMessage_C@198cb3dtext_lob=m_boolClass=class java.lang.Booleanm_byteClass=class java.lang.Bytem_shortClass=class java.lang.Bytem_intClass=class java.lang.Integerm_longClass=class java.lang.Longm_floatClass=class java.lang.Floatm_doubleClass=class java.lang.Doublem_strClass=class java.lang.Stringm_systemProperties={JMSXDeliveryCount=class java.lang.Integer, JMS_OracleConnectionID=class java.lang.String, JMSXGroupSeq=class java.lang.Integer, JMSXAppID=class java.lang.String, JMSXRecvTimestamp=class java.lang.Long, JMS_OracleExcpQ=class java.lang.String, JMS_OracleHeaderOnly=class java.lang.String, JMS_OracleOriginalMessageID=class java.lang.String, JMSXGroupID=class java.lang.String, JMSXUserID=class java.lang.String, JMS_OracleDeliveryMode=class java.lang.String, JMS_OracleTimestamp=class java.lang.Long, JMS_OracleDelay=class java.lang.Long, JMSXState=class java.lang.Integer}m_settableSystemProperties=[JMSXGroupID, JMSXGroupSeq]header_ext=oracle.jms.AQjmsMessageHeaderExt@472d48message_id=oracle.jms.AQjmsMessageID@edf3f6enqueue_time=1265887454000corr_id=msg_dest=test.myaqdel_mode=2redelivered=trueexpiration=0priority=1msg_properties={JMS_OracleDeliveryMode=oracle.jms.AQjmsPropDatum@2bc3f5}access_mode=0prop_read_only=truerecv_time=1265891032384msg_state=0excp_queue=msg_delay=0orig_msg_id=sender_id=attempts=5m_signature=session=oracle.jms.AQjmsSession@a613f8m_hdrOnly=falsem_isjmsbody=truecompliant=falseJMS_REPLY_TO=JMSReplyTo}

And the broken one:

{text_data=???text_msg_cont=oracle.jms.AQjmsTextMessage_C@1bf3d87gen_msg_cont=oracle.jms.AQjmsGenMessage_C@60991ftext_lob=m_boolClass=class java.lang.Booleanm_byteClass=class java.lang.Bytem_shortClass=class java.lang.Bytem_intClass=class java.lang.Integerm_longClass=class java.lang.Longm_floatClass=class java.lang.Floatm_doubleClass=class java.lang.Doublem_strClass=class java.lang.Stringm_systemProperties={JMSXDeliveryCount=class java.lang.Integer, JMS_OracleConnectionID=class java.lang.String, JMSXGroupSeq=class java.lang.Integer, JMSXAppID=class java.lang.String, JMSXRecvTimestamp=class java.lang.Long, JMS_OracleExcpQ=class java.lang.String, JMS_OracleHeaderOnly=class java.lang.String, JMS_OracleOriginalMessageID=class java.lang.String, JMSXGroupID=class java.lang.String, JMSXUserID=class java.lang.String, JMS_OracleDeliveryMode=class java.lang.String, JMS_OracleTimestamp=class java.lang.Long, JMS_OracleDelay=class java.lang.Long, JMSXState=class java.lang.Integer}m_settableSystemProperties=[JMSXGroupSeq, JMSXGroupID]header_ext=oracle.jms.AQjmsMessageHeaderExt@1e4f7c2message_id=oracle.jms.AQjmsMessageID@145f0e3enqueue_time=1265890738000corr_id=msg_dest=test.myaqdel_mode=2redelivered=trueexpiration=0priority=1msg_properties={???=oracle.jms.AQjmsPropDatum@c9d92c}access_mode=0prop_read_only=truerecv_time=1265891388844msg_state=0excp_queue=msg_delay=0orig_msg_id=sender_id=attempts=1m_signature=session=oracle.jms.AQjmsSession@60e128m_hdrOnly=falsem_isjmsbody=truecompliant=falseJMS_REPLY_TO=JMSReplyTo}
A: 

I have the same issue. The only one differences with databases is oracle NLS_CHARACTERSET parameter. if NLS_CHARACTERSET = WE8MSWIN1252 message parameters receives well. if NLS_CHARACTERSET = CL8MSWIN1251 - message params contains only '???' in param names.

I do not know how to resolve this. Any ideas?

DenisV
A: 

Solution found and issue fixed. Adding orai18n.jar to web server application classpath resolves problem.

DenisV