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 » Problem in calling java method

Post new topic  Reply to topic
 Problem in calling java method « View previous topic :: View next topic » 
Author Message
nmaddisetti
PostPosted: Sat Mar 25, 2006 4:33 am    Post subject: Problem in calling java method Reply with quote

Centurion

Joined: 06 Oct 2004
Posts: 145

Hi,

I am using MB 6.0.
I am calling a java method and it returns Double[] from java method
in ESQL prcedure iam using return type as FLOAT then it is giveng me exception as ESQL and JAVA return type mismatch

and if i am using INOUT parameter it is working fine
what might be the problem.

Thanks,
nmaddisetti.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Mar 25, 2006 5:11 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Working as designed. You need to pass the parms as reference. Anyway I doubt very much that a float would match a double[]. This should blow up somewhere else.
If ESQL Float matches java double (to be verified) then at the least you should try Float[] as your return is double[].
Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jbanoop
PostPosted: Sat Mar 25, 2006 6:37 am    Post subject: Reply with quote

Chevalier

Joined: 17 Sep 2005
Posts: 401
Location: SC

* ESQL FLOAT can be passed in as INOUT parameter and its counterpart in java is java.lang.Double[] (yes a Double[] i dont know the reason but so it says in the documentation and it works as well).

* When using the RETURNS FLOAT in the procedure definition in ESQL, the counterpart in java seems to be java.lang.Double. (more like it but wonder why the difference).

ESQL data types Java IN data types Java INOUT/OUT data types
FLOAT java.lang.Double java.lang.Double[]

The document seems to be silent on whether the return type is treated as IN or OUT or whatever ..

Hope this helps.
Back to top
View user's profile Send private message Yahoo Messenger
mgk
PostPosted: Sat Mar 25, 2006 7:36 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

The return datatype cannot be an Array. This is mentioned in the docs.
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
jbanoop
PostPosted: Sat Mar 25, 2006 10:19 pm    Post subject: Reply with quote

Chevalier

Joined: 17 Sep 2005
Posts: 401
Location: SC

Hi Mgk,
Is there any reason why for INOUT parameters the mapping between a singular FLOAT type in ESQL becomes an array (java.lang.Double[]) in java. just curious.

Regards,
Anoop
Back to top
View user's profile Send private message Yahoo Messenger
mgk
PostPosted: Sun Mar 26, 2006 8:45 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Well all the ESQL Datatypes allow values to be NULL, whereas non of the Java primatives can be NULL. Therefore, IN datatypes require the Java 'Object Wrappers' (java.lang.Integer etc) to be used. In the case of INOUT and OUT datatypes, in addition to having to allow NULL, ESQL allows the actual values passed to a method can be changed inside that method. But because of the way Java passes parameters to methods, you cannot change an object passed into a method and have the caller see that change. However, with an array you can change the members inside the array and the caller can see the changes you made. Hence the need for the use of single element arrays to support INOUT and OUT parameters.

Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
jbanoop
PostPosted: Mon Mar 27, 2006 2:37 am    Post subject: Reply with quote

Chevalier

Joined: 17 Sep 2005
Posts: 401
Location: SC

Thanks mgk. Got it.
Anoop
Back to top
View user's profile Send private message Yahoo Messenger
vmurali_au
PostPosted: Thu Aug 16, 2007 1:12 pm    Post subject: Reply with quote

Voyager

Joined: 26 Mar 2004
Posts: 76

I dont get it.

I'm trying to pass some 2 OUT parameters to java method and set the value for those params inside the method.

Code:
DECLARE var1 CHARACTER;
DECLARE var2 BLOB;

CALL javaProc(var1, var2);


javaProc is defined as

Code:
javaProc(OUT var1, OUT var2)



Code:
static void javaProc(String[] var1, byte[][] var2)
{

var1 = new String[]{"THIS IS A TEST"};
var2 = new byte[][]{"THIS IS A TEST".getBytes()};

}


When the above method returns i dont see the value of var1 & var2 to be populated in the ESQL code.

Am i doing something wrong here?
Back to top
View user's profile Send private message
vmurali_au
PostPosted: Fri Aug 17, 2007 1:54 pm    Post subject: Reply with quote

Voyager

Joined: 26 Mar 2004
Posts: 76

any idea guys ???
Back to top
View user's profile Send private message
vmurali_au
PostPosted: Wed Aug 22, 2007 12:08 pm    Post subject: Reply with quote

Voyager

Joined: 26 Mar 2004
Posts: 76

Can someone let me know how to populate the value for a IN variable in a java procedure and send the result out to the ESQL code.

Thanks in Advance.
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 » Problem in calling java method
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.