Overview of creating opaque types and UDRs

In the database server, any Java™ class that implements the java.sql.SQLData interface and is accessible to the Java Virtual Machine can be stored as an opaque type. The UDTManager and UDRManager classes, together with their supporting UDTMetaData and UDRMetaData classes, extend this facility to client applications: your Java client application can use these classes to create opaque types and user-defined routines and transfer their class definitions to the database server. The client does not need to be accessible to the database server to use this functionality.
Important: This functionality is tightly coupled with server support for creating and using Java opaque types and user-defined routines. Any limitations on using Java opaque types and user-defined routines that exist in your version of the database server apply equally to Java opaque types and routines you create in your client applications.
When you use the UDTManager and UDTMetaData classes, HCL OneDB™ JDBC Driver performs all of the following actions for your application:
  1. Obtains the JAR file you specify
  2. Transports the JAR file from the client local area to the server local area

    You define the server local area using the UDTManager.setJarFileTmpPath() method. The default is /tmp on UNIX™ systems and C:\temp on Windows™ systems.

  3. Installs the JAR file in the server
  4. Registers the opaque data type in the database with the CREATE OPAQUE TYPE SQL statement, taking input from the UDTMetaData class
  5. Registers the support functions and casts you provide for the opaque type using the CREATE Function and CREATE CAST SQL statements

    You define support functions and casts using the setSupportUDR() and setXXXCast() methods in the UDTMetaData class.

    If you do not provide input and output functions for the opaque type, the driver registers the default functions (see the release notes for any limitations on this feature).

  6. Registers any other nonsupport routines or casts (if any) that you specified, taking input from the UDTMetaData.setUDR() and UDTMetaData.setXXXCast() method calls in your application
  7. Creates a mapping between an SQL OPAQUE type and a Java object (using the sqlj.setUDTExtName() method)
When you use the UDRManager and UDRMetaData classes, HCL OneDB JDBC Driver performs the following actions:
  1. Obtains the JAR file you specify
  2. Transports the JAR file from the client local area to the server local area
  3. Installs the JAR file in the server
  4. Registers the UDRs in the database with the CREATE FUNCTION SQL statement, taking input from the UDRMetaData.setUDR() method calls in your application
The methods in the UDT and UDR Manager facility perform the following main functions:
  • Creating opaque types in Java without preexisting Java classes, using the default input and output methods the server provides
  • Converting existing Java classes on the client to opaque types and UDRs in the database server
  • Converting Java static methods to UDRs