SQL definitions for default I/O user-defined routines

After you register the Java™ UDT with the database server by using the SQL procedure setUDTExtName(), you can create SQL functions and casts for it, using either the default I/O wrapper methods or explicit methods in your Java UDT class.

For the default I/O wrapper methods, the registerJUDTfuncs function creates the SQL functions shown in the following example, where SQLType is the SQL UDT name, JavaType is the JUDT name, and SQLBuffer is the SQL transport type being converted, that is, SENDRECV:
-- Receive function
       
CREATE IMPLICIT CAST (SENDRECV as SQLUDT with
   IfxJavaSENDRECVInJavaUDT);
CREATE FUNCTION IfxJavaSENDRECVInJavaUDT (in SENDRECV) 
   RETURNS SQLUDT
EXTERNAL NAME 
’com.informix.jdbc.IfxDataPointer.IfxDataInput(java.lang.Object)’
LANGUAGE java;
GRANT EXECUTE ON FUNCTION IfxJavaSENDRECVInJavaUDT TO PUBLIC;
       
-- Send function

CREATE EXPLICIT CAST (SQLUDT as SENDRECV with
   IfxJavaSENDRECVOutJavaUDT);
CREATE FUNCTION IfxJavaSENDRECVOutJavaUDT(out SQLUDT) RETURNS
   SENDRECV
EXTERNAL NAME ’com.informix.jdbc.IfxDataPointer.IfxDataOutput(java.sql.SQLData)’
LANGUAGE java NOT VARIANT;
GRANT EXECUTE ON IfxJavaSENDRECVOutJavaUDT TO PUBLIC;

The default Input method cannot be declared not variant because it might need to perform SQL queries to instantiate the correct Java UDT class.