Connecting Tech Pros Worldwide Forums | Help | Site Map

db2 v9.1 UDF in C, Windows platform

Newbie
 
Join Date: Jun 2009
Posts: 3
#1: Jun 11 '09
Hello everyone,

i am having some problems with a very simple UDF function writen in C.

I have compiled the c file into a DLL ( used Dev-C++ ) an copyed the dll into functions directory ( C:\Program Files\IBM\SQLLIB\FUNCTION\ ). When i run the function ( VALUES(CLOBCOMP(CLOB('A'),CLOB('A'))) ) i get the following error:

SQL0444N Routine "XX.CLOBCOMP" (specific name "CLOBCOMP") is implemented with code in library or path "\ClobComp", function "ClobComp" which cannot be accessed. Reason code: "6". SQLSTATE=42724

Code example C:
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <sqludf.h>
  4.  
  5. #if defined(__cplusplus)
  6. extern "C"
  7. #endif
  8.  
  9. void SQL_API_FN ClobComp( SQLUDF_CLOB *clob_1, SQLUDF_CLOB *clob_2, SQLUDF_INTEGER *int_1, SQLUDF_TRAIL_ARGS)
  10. {
  11.  *int_1 = 0;
  12.     if (clob_1 == clob_2) {
  13.         *int_1 = 1;
  14.     }
  15.  return;
  16. }
  17.  
Sql function:
Expand|Select|Wrap|Line Numbers
  1. CREATE FUNCTION CLOBCOMP( CLOB(2M), CLOB(2M))
  2. RETURNS INTEGER
  3. EXTERNAL NAME 'ClobComp!ClobComp'
  4. SPECIFIC CLOBCOMP
  5. LANGUAGE C
  6. PARAMETER STYLE DB2SQL
  7. DETERMINISTIC
  8. NOT FENCED THREADSAFE
  9. NO SQL
  10.  
System path information:
Expand|Select|Wrap|Line Numbers
  1. Path=C:\Program Files\IBM\SQLLIB\BIN;C:\Program Files\IBM\SQLLIB\FUNCTION;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Syst
  2. em32\Wbem;C:\Program Files\Common Files\Lenovo;C:\Program Files\Lenovo
  3. \Client Security Solution;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\
  4. Microsoft Visual Studio 9.0\VC\bin\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL
  5.  Server\100\DTS\Binn\;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\;C:\Program Files\OpenVPN\bin
  6.  

Any help will be very apriciated.

best regards,

Marko

Reply