Results 1 to 7 of 7
  1. #1
    Join Date
    May 2012
    Posts
    155

    Unanswered: user definied functions for DB2

    Hallo everyone,

    if I want to build UDF for DB2, which languange I should use? Thank you.

    Regards,
    Ratna

  2. #2
    Join Date
    Oct 2009
    Location
    221B Baker St.
    Posts
    486
    The language most suited to your need that conforms to the organization's standards.

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by papadi View Post
    The language most suited to your need that conforms to the organization's standards.
    It's a little more complicated than that because there can be a big difference in performance depending on the language and fenced/not fenced, etc.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  4. #4
    Join Date
    Oct 2009
    Location
    221B Baker St.
    Posts
    486
    Yes, there can be a big difference - but that usually does not win out over local politics.

    If the standard is misguided, then the standard should be revised (easily said, not so easily accomplished<g>). It has been quite some time since a client of mine was heavily interested technical details like this.

    I guess my main point is that the choice of language should not be a programmer's decision.

  5. #5
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Performance is usually part of the "need" as well. So I concur with papadi: use what fits the technical requirements and is in line with organizational restrictions, too.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  6. #6
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    I still do not think it is that simple. A DB2 routine in java is always fenced, and with C it can be fenced or not fenced. Not fenced is much more efficient.

    Of course, if the DB2 routine can be done in SQL (always not fenced), then that is always preferred above java or C for a multitude of reasons.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  7. #7
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    It really depends... if your function does some fairly complex calculations (spatial operations come to mind), then the difference between fenced and not fenced may become negligible. After all, the fencing only implies that the transfer of parameter values from DB2 to the function (for each invocation) and the transfer of results back to DB2 is slower due to the needed IPC. The actual execution speed inside the function is not different.

    p.s: A couple years back some guys attempted to move logic from a Java client application into a stored procedure and then wondered why things were not much faster (which is actually pretty obvious if you just move the location where a certain piece of code is executed). The SP in question didn't do very much in terms of interaction with the database system so that the improvements for this part due to the execution close to the database system didn't have much impact.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •