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 » WebSphere Message Broker (ACE) Support » WMB6 - problem with DB insert from Java Compute node

Post new topic  Reply to topic
 WMB6 - problem with DB insert from Java Compute node « View previous topic :: View next topic » 
Author Message
Cliff
PostPosted: Tue Oct 18, 2005 6:15 am    Post subject: WMB6 - problem with DB insert from Java Compute node Reply with quote

Centurion

Joined: 27 Jun 2001
Posts: 145
Location: Wiltshire

Folks,

it seems to be mandatory to use correlation names for the values in an INSERT statement such as this:

MbSQLStatement stmt = createSQLStatement( "DBNAME",
"PASSTHRU('INSERT INTO TABLENAME (TIMESTAMP, BROKER, EXECUTIONGROUP, MESSAGEFLOW, QMGR, QUEUE, MSGID, CORRELID, DIAGNOSTIC_DATA) VALUES (?,?,?,?,?,?,?,?,?)'," +
"Environment.FLOWENV.DateTime, _brokerName, _executionGroupName, _messageFlowName, _queueManagerName, _queueName, _msgId, _correlId, 'DIAGNOSTIC STRING');");

This chokes on _brokerName, a String variable set earlier on. Now either I've missed a trick somewhere or I'll have to stash every variable I want to use in a SQL statement in the Environment (or other valid tree).

Can anyone enlighten me? The manuals can't.

Thanks -
Cliff
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Tue Oct 18, 2005 6:28 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Do you want the value of _brokerName, and etc?

Then should it be more like
Code:
 MbSQLStatement stmt = createSQLStatement( "DBNAME",
"PASSTHRU('INSERT INTO TABLENAME (TIMESTAMP, BROKER, EXECUTIONGROUP, MESSAGEFLOW, QMGR, QUEUE, MSGID, CORRELID, DIAGNOSTIC_DATA) VALUES (?,?,?,?,?,?,?,?,?)'," +
"Environment.FLOWENV.DateTime,"+ _brokerName+","+ _executionGroupName+","+_messageFlowName+","+ _queueManagerName+","+_queueName+","+_msgId+","+ _correlId+","+"'DIAGNOSTIC STRING');");

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Cliff
PostPosted: Wed Oct 19, 2005 12:13 am    Post subject: Reply with quote

Centurion

Joined: 27 Jun 2001
Posts: 145
Location: Wiltshire

Thanks, Jeff.

What you suggest is on the right lines but I'm still having fun getting the syntax right - the string containing the comma-separated variables seems to be being interpreted as a list! I get "Syntax error : ''[''. " at runtime - I'll keep bashing away though and post the result here when I finally get it to work.

Cheers -
Cliff
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Oct 19, 2005 3:35 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Try building the string outside of the createSQLStatement procedure, and pass it as a parameter explictly.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Cliff
PostPosted: Mon Oct 24, 2005 2:27 am    Post subject: Reply with quote

Centurion

Joined: 27 Jun 2001
Posts: 145
Location: Wiltshire

Jeff,

that's exactly what I'm trying. Still no luck though <sigh>.
I have some other work to do now, but I'll return to this whenever I can.

Cheers -
Cliff
Back to top
View user's profile Send private message Send e-mail
neerav
PostPosted: Wed Jul 19, 2006 7:42 am    Post subject: Reply with quote

Novice

Joined: 31 May 2006
Posts: 22

I am also facing problem while inserting into the DB.

Here's the query :
----------------------------------------------------------------------------
String INSERTquery = "INSERT INTO Database.CRMDBA.CRM_BKR_AUD_LOG (tran_id" +
",msg_id," +
"srvc_name_txt," +
" srvc_vrsn_nbr," +
"msg_typ_txt," +
"pyld_fmt_txt," +
"xchg_prtcl_txt," +
"src_lgcl_txt," +
"src_envmt_txt," +
"src_prtcl_txt," +
"trgt_lgcl_txt," +
"trgt_envmt_txt," +
"trgt_prtcl_txt," +
"trgt_addr_txt," +
"clnt_usr_id," +
"msg_pth_txt," +
"aud_mod_txt," +
"msg_pyld_txt," +
"insert_ts," +
"create_dt," +
"modify_dt) " +
"values('" +tranID+ "','" +msgID+ "','" +serviceName+ "'," +serviceNumber+ ",'" +msgType+ "','" + payloadFormat + "','" +exchangeProtocol+ "','" + sourceLogicalName
+ "','" +sourceEnvironment+ "','" +sourceProtocol+ "','" +targetLogicalName+ "','" +targetEnvironment+ "','" +targetProtocol+ "','" +targetAddress
+ "','" +clientUserID+ "','" +msgPath+ "','" +auditModule+ "','" +msgPayload+ "','" +insertTimeStamp+ "','" +createDt+ "','" +modifyDt+ "') ;" ;

MbSQLStatement state = createSQLStatement(dataSourceName,INSERTquery );
----------------------------------------------------------------------------

Here's the exception:
----------------------------------------
----------------------------------------
2006-07-19 11:26:30,592 (main_JavaCompute.java:134) DEBUG - state.getStatement() : INSERT INTO Database.CRMDBA.CRM_BKR_AUD_LOG (tran_id,msg_id,srvc_name_txt, srvc_vrsn_nbr,msg_typ_txt,pyld_fmt_txt,xchg_prtcl_txt,src_lgcl_txt,src_envmt_txt,src_prtcl_txt,trgt_lgcl_txt,trgt_envmt_txt,trgt_prtcl_txt,trgt_addr_txt,clnt_usr_id,msg_pth_txt,aud_mod_txt,msg_pyld_txt,insert_ts,create_dt,modify_dt) values('AX85070D1338313596','mymsgID','myServiceName',1,'mymsgType','mypayloadFormat','myexchangeProtocol','mysourceLogicalName','mysrcEnv','mysrcProtl','mytargLogNme','mytargEnv','mytargProtl','mytargAddr','myclntUsrID','mymsgPath','BROKER','<mymsgPayload>hello</mymsgPayload>','12-JUL-1234','12-JUL-1234','12-JUL-1234') ;
2006-07-19 11:26:30,592 (main_JavaCompute.java:142) DEBUG -
2006-07-19 11:26:30,592 (main_JavaCompute.java:147) INFO - Executing INSERTquery
2006-07-19 11:26:30,795 (main_JavaCompute.java:164) ERROR - Exception caught thru MbException: <com.ibm.broker.plugin.MbFatalException class:JNI method:SqlStatementGroup::execute source:BIPv600 key:2488 >
2006-07-19 11:26:30,795 (main_JavaCompute.java:165) ERROR - MbException Trace: Error detected, rethrowing
2006-07-19 11:26:30,795 (main_JavaCompute.java:166) ERROR -
2006-07-19 11:26:30,795 (main_JavaCompute.java:167) ERROR - ******************************************************

May i know what the problem is? I have tried to execute this query directly on the DB client (removing Database. and table alias) and it worked.

Reg,
N
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 » WebSphere Message Broker (ACE) Support » WMB6 - problem with DB insert from Java Compute node
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.