Solved

calling java from DB2

Posted on 2003-11-07
4
747 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to get the substring vaule in db2 11 308
SQL UPDATE QUERY PROBLEM 5 191
Data transfer to iSeries failing with message ID SQL0462 6 207
Another SQL with parm Part 2 44 128
November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
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…
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…

734 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