Author |
Message
|
sai kumar adduri |
Posted: Wed Aug 21, 2013 11:11 pm Post subject: call a java method in esql |
|
|
Acolyte
Joined: 04 Apr 2013 Posts: 73
|
Hi all ,
I am trying to call a java method in esql , i am getting a class not found exception .
java method:
public static createMqmdHeaders(MbElement p_outRoot, int p_ccsid,
int p_encoding) throws MbException {
MbElement l_mqmd = p_outRoot.createElementAsFirstChild("MQHMD");
l_mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE, "Version",
new Integer(2));
l_mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE, "Format",
MQC.MQFMT_RF_HEADER_2);
l_mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE, "Encoding",
p_encoding);
l_mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,
"CodedCharSetId", p_ccsid);
;
ESQL procedure:
CREATE PROCEDURE createMqmdHeaders(INOUT outRef REFERENCE,IN ccsid INTEGER ,IN encoding INTEGER )Returns BOOLEAN
LANGUAGE JAVA
EXTERNAL NAME "com.mss.MbMsgUtils.createMqmdHeaders";
Is it the correct way to use INOUT in the above procedure |
|
Back to top |
|
 |
dogorsy |
Posted: Thu Aug 22, 2013 12:30 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
you don't need to write a java program to do what you are doing. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Aug 22, 2013 12:40 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
The OP might be trying to use Java simply because he/she has been told to use it instead of ESQL. Until they give a reason for this, you shouldn't be so dismissive. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
dogorsy |
Posted: Thu Aug 22, 2013 12:45 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
smdavies99 wrote: |
The OP might be trying to use Java simply because he/she has been told to use it instead of ESQL. Until they give a reason for this, you shouldn't be so dismissive. |
Argumentative today, are we ? |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Aug 22, 2013 1:13 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
not really. Just looking at the facts. your point is correct but you have no idea if it is relevant to the problem that the OP is trying to solve. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Simbu |
Posted: Thu Aug 22, 2013 1:37 am Post subject: Re: call a java method in esql |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
sai kumar adduri wrote: |
java method:
public static createMqmdHeaders(MbElement p_outRoot, int p_ccsid,
int p_encoding) throws MbException
ESQL procedure:
CREATE PROCEDURE createMqmdHeaders(INOUT outRef REFERENCE,IN ccsid INTEGER ,IN encoding INTEGER )Returns BOOLEAN
LANGUAGE JAVA
EXTERNAL NAME "com.mss.MbMsgUtils.createMqmdHeaders";
Is it the correct way to use INOUT in the above procedure |
Please do search in this forum. you will get answers |
|
Back to top |
|
 |
rekarm01 |
Posted: Thu Aug 22, 2013 1:55 am Post subject: Re: call a java method in esql |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
Please use [code] tags when posting code; it's much easier to read.
sai kumar adduri wrote: |
Is it the correct way to use INOUT in the above procedure |
That is the correct way to use INOUT, but the ESQL procedure does not match the Java method signature (including the parameter types and the throws clause). The InfoCenter describes the requirements for Java routines in more detail. Java methods also require a return type. |
|
Back to top |
|
 |
sai kumar adduri |
Posted: Thu Aug 22, 2013 1:57 am Post subject: |
|
|
Acolyte
Joined: 04 Apr 2013 Posts: 73
|
Reason to use this is , to resuse the exisiting java code . All though it is a simple function , but I have methods which are complex .
Dont go by the functionality of the method , even I known that it can be implemented in esql . |
|
Back to top |
|
 |
|