Creating an opaque type from existing code
About this task
The preceding topics describe methods you use to create a new opaque type without an existing Java™ class. When you create an opaque type from existing Java™ code, you specify the SQL name, JAR file SQL name, support UDRs (if any), and any additional nonsupport UDRs that are included in the opaque type. (For an explanation of SQL names, see SQL names.) You can also specify the length, alignment, and implicit and explicit casts.
To create an opaque type from existing code, use the following methods:
- UDTMetaData.setSQLName() to specify the SQL name of the opaque type as referenced in SQL statements
- UDTMetaData.setSupportUDR() for each support
UDR in the opaque type
Support UDRs are input/output, send/receive, and so forth.
- UDTMetaData.setUDR() for each nonsupport UDR in the opaque type
- UDTMetaData.setJarFileSQLName() to specify an SQL name for the JAR file
- UDTMetaData.setImplicitCast() or UDTMetaData.setExplicitCast() to specify each cast
- UDTMetaData.setLength() if the opaque type is fixed length (the driver defaults to variable length)
- UDTMetaData.setAlignment() to specify the byte boundary on which the opaque type is aligned (necessary only if you do not want the database server to default to a 4-byte boundary)
- UDTManager.createJar() to create a JAR (.jar) file if you do not already have one
- UDTManager.createUDT() to create the opaque type
In addition, the setXXXCast(), setSupportUDR(),
and setUDR() methods are used only for creating an opaque type
from existing code:
public void setImplicitCast(int ifxtype, String methodsqlname)
throws SQLException
public void setExplicitCast(int ifxtype, String methodsqlname)
throws SQLException
public void setSupportUDR(Method method, String sqlname, int type)
throws SQLException
public void setUDR(Method method, String sqlname)
throws SQLException