473,699 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

table udf's and java

Hi all

I've been searching the Internet for a while and I've been trying to
find any resources on return tables using UDF's with Java. I've been
sucessful in returning integers, etc, but I have trouble finding
anything about return tables. Can such a thing be done in Java? If so,
can someone direct me to an example or have an example of implementing
such a thing. Or if there isn't, does anyone have a recommendation or
example on alternatives? Thanks

Nov 12 '05 #1
5 1813
jcccs05 wrote:
Hi all

I've been searching the Internet for a while and I've been trying to
find any resources on return tables using UDF's with Java. I've been
sucessful in returning integers, etc, but I have trouble finding
anything about return tables. Can such a thing be done in Java?
Yes, that's possible.
If so,
can someone direct me to an example or have an example of implementing
such a thing. Or if there isn't, does anyone have a recommendation or
example on alternatives? Thanks


What's your problem exactly?

(I just updated one of my articles to include a Java table UDF, but it's not
yet published.)

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #2

"jcccs05" <jc****@gmail.c om> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hi all

I've been searching the Internet for a while and I've been trying to
find any resources on return tables using UDF's with Java. I've been
sucessful in returning integers, etc, but I have trouble finding
anything about return tables. Can such a thing be done in Java?
Yes. The IBM manuals clearly show this. (You didn't say which version of DB2
you are using or what operating system you are running so I'm assuming that
you are using Version 8 of DB2 for Linux, Unix and Windows.)
If so,
can someone direct me to an example or have an example of implementing
such a thing.
Search your Info Center on "table UDF". There are discussions of the
concepts of a table UDF and the statements that are used to prepare a table
UDF. There are also some examples in the Samples part of the Info Center;
these samples are written in all or most of the languages that DB2 supports
for UDFs including Java.
Or if there isn't, does anyone have a recommendation or
example on alternatives? Thanks

Rhino
Nov 12 '05 #3
One thing to be careful about is not to PARAMETER STYLE JAVA if you
want to write Java table function. Stick with PARAMETER STYLE
DB2GENERAL.

Nov 12 '05 #4
I am using version 8 of DB2 under windows. I found the samples under
the samples part of the info center. I was wondering if there are any
other resources that help to further explain what is exactly going on
and how the client interacts with the server in the sample as well as
how the scratchpad is exactly working. Thanks for the help.

Nov 12 '05 #5

"jcccs05" <jc****@gmail.c om> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
I am using version 8 of DB2 under windows. I found the samples under
the samples part of the info center. I was wondering if there are any
other resources that help to further explain what is exactly going on
and how the client interacts with the server in the sample as well as
how the scratchpad is exactly working. Thanks for the help.

I don't work in the IBM lab so I don't have any "inside" knowledge. However,
you can learn a bit more by using System.out.prin tln() statements to write
to a flat file within your UDFs. Then try making changes to the examples to
see what works and what doesn't.

As far as I can tell, the documentation describing the "Table function
processing model" is accurate and should give you reasonable insight into
what is happening. The System.out.prin tln() statements that you add to your
code should confirm what you see in the manuals.

With regards to the scratchpad, the sample programs show setScratchpad() and
getScratchpad() being used with streams but, so far, I've found that an
ordinary class variable works just as well without all the bother of reading
and writing byte streams. The manual mentions that both can be used, which
is what inspired me to try it in the first place.

As usual with DB2, the manual doesn't tell you everything you might like to
know. For instance, I can't find anything that says categorically whether
this is any real risk to using class variables rather than
getScratchpad()/setScratchpad() in UDFs. By the same token, I can't find any
categorical statement that says that you can or cannot access other non-UDF
Java classes from your UDF. For questions like this, you can try posting to
this newsgroup and asking but you may not get a categorical answer from IBM,
just an educated guess from another user like yourself.

Another resource that might be useful is the DeveloperWorks site, which is
accessible from the IBM site. Some of the articles there are quite
interesting; I'm just reading one on combining a trigger, a UDF and JavaMail
to send an email to a customer when their credit card purchases are
approaching their credit limit.

Rhino
Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5822
by: Abram Friesen | last post by:
Hi all, I'm a newbie at DB2 and trying to create a simple java UDF. When I call my function, I'm receiving SQL4306N. Could someone please tell me what I'm doing wrong here? Here is my java code for a UDF that simply returns the integer value you pass it:
7
1994
by: Rhino | last post by:
I was reading the DB2 for Linux/Unix/Windows (V7.2) manuals just now to get some background information about UDFs when I came across this: "Note that valuable debugging tools such as printf() do not normally work as debugging aids for your UDF, because the UDF normally runs in a background process where stdout has no meaning. As an alternative to using printf(), it may be possible for you to instrument your UDF with file output logic,...
7
1595
by: Rhino | last post by:
Since I haven't been able to find out yet how to get my Eclipse debugger to step through my Java UDF code, I am adding old-style File I/O debugging to some of my UDFs. I'm not sure of the best way to design this though and am looking for some suggestions. Since my class might contain several UDF methods, for instance, several versions of the same basic UDF but with different signatures for different situations, e.g. count(needle,...
4
1829
by: Rhino | last post by:
I've been playing with Java UDFs for the last couple of days and I've got some questions about scratchpads. I'm running DB2 LUW V8 (FP8) on WinXP. Somewhere in the manuals, I found some remarks that said I could either manage my scratchpad with the getScratchpad() and setScratchpad() methods *OR* set up my own class variables to keep the state between invocations of the UDF. (I can't find those remarks again right now but I know I saw...
6
2057
by: Rhino | last post by:
I am writing Java UDFs using DB2 V8.2 (Fixpack 8) on Windows XP. I would like to create some common code classes that are visible to the UDFs on my system but I'm not having a lot of luck so far. I'm wondering if I'm trying to do the impossible or if my technique is just wrong. One of the common code classes I want to write contains code to open, write and close a flat file that can be used for debugging. I'd like that class to be...
3
2008
by: gimme_this_gimme_that | last post by:
I'm driving Windows XP and could use a tip on installing a function written in Java. 1. I created the a Java jar file, named UdfUtils.jar, from the Java source file shown below: 2. I copied the jar file to c:\Program Files\IBM\SQLLIB\FUNCTION 3. From the db2 command line I exectued call sqlj.refresh_classes() 4. I defined a function using the ddl also shown below Now ...
6
2436
by: Rhino | last post by:
I'm trying to debug a simple Java UDF written in the DB2General style within Eclipse. I'm getting a java.lang.UnsatisfiedLinkError when I execute the set() method in the UDF. I know that the UnsatisfiedLinkError has something to do with a DLL that is not visible but I'm not sure why I'm having the problem given that both db2java.zip and db2jcc.jar are visible on my classpath and each of them contain the COM.ibm.db2.app.UDF class with a...
8
5005
by: gimme_this_gimme_that | last post by:
I have the following Java code : package com.rhi.bb.udf.utils; import java.sql.Clob; import java.sql.SQLException; import java.util.regex.Pattern; import java.util.regex.Matcher;
1
5987
by: okonita | last post by:
Hello all, I have a Java problem that I hope can be answered here. Very new to DB2 UDB and UDF (we are on DB2v9.5, Linux and Windows), I have managed to get the UDF registered but having problem getting the Java code to work. I need assistance to get this Double Metaphone Java UDF to work pretty quickly. Here is what I tried to run and the error message that resulted: SQL select nm_frst, NM_LST,...
0
8691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8620
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8887
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2351
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2012
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.