Solved

calling java from DB2

Posted on 2003-11-07
4
743 Views
Last Modified: 2008-03-06
hi
   i'm having a java file and let's assume the class file is also with me.
how can i call the same java file from my stored procedure in DB2??
i mean i want to use methods of such java file in my stored procedure..

can anyone give me the complete steps.
it would be great if detailed steps can be stated.....

thanks
kabi satpathy
0
Comment
Question by:bkkabi
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
BigSchmuh earned 300 total points
ID: 9717971
I am not very familiar with Java programming but I think you just need to do the following to be able to use a Java class from inside your DB2 proc.

You may define a function/proc which reference your external Java code.
I hope the following sample will be enough for you to define a reference to every needed of your Java functions.

CREATE PROCEDURE YourJavaFunc (IN aDouble DOUBLE, INOUT aInt INTEGER, OUT aChar20 CHAR(20))
DYNAMIC RESULT SETS 0
LANGUAGE JAVA
PARAMETER STYLE JAVA
NO DBINFO
FENCED
READS SQL DATA
PROGRAM TYPE SUB
EXTERNAL NAME 'YourClass.YourMethod'

Other kind of parameters are available:
"DYNAMIC RESULT SETS 1" if your Java class may returned data (There are some examples about this)
"MODIFIES SQL DATA" if your Java class makes modifications to data

Hope this helps.
0
 
LVL 18

Expert Comment

by:BigSchmuh
ID: 9718015
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question