Solved

calling java from DB2

Posted on 2003-11-07
4
734 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 (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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now