IN and OUT parameter type mapping

An exception is thrown by the registerOutParameter(int, int), registerOutParameter(int, int, int), or setNull(int, int) method if the driver cannot find a matching HCL OneDB™ type or finds a mapping ambiguity (more than one matching HCL OneDB type). The table that follows shows the mappings the CallableStatement interface uses. Asterisks ( * ) indicate mapping ambiguities.

java.sql.Types com.informix.lang.IfxTypes
Array* IFX_TYPE_LIST

IFX_TYPE_MULTISET

IFX_TYPE_SET

Bigint IFX_TYPE_INT8
Binary IFX_TYPE_BYTE
Bit Not supported
Blob IFX_TYPE_BLOB
Char IFX_TYPE_CHAR (n)
Clob IFX_TYPE_CLOB
Date IFX_TYPE_DATE
Decimal IFX_TYPE_DECIMAL
Distinct* Depends on base type
Double IFX_TYPE_FLOAT
Float IFX_TYPE_FLOAT1
Integer IFX_TYPE_INT
Java_Object* IFX_TYPE_UDTVAR

IFX_TYPE_UDTFIX

Long IFX_TYPE_BIGINT

IFX_TYPE_BIGSERIAL

Longvarbinary* IFX_TYPE_BYTE

IFX_TYPE_BLOB

Longvarchar* IFX_TYPE_TEXT

IFX_TYPE_CLOB

IFX_TYPE_LVARCHAR

Null Not supported
Numeric IFX_TYPE_DECMIAL
Other Not supported
Real IFX_TYPE_SMFLOAT
Ref Not supported
Smallint IFX_TYPE_SMINT
Struct IFX_TYPE_ROW
Time IFX_TYPE_DTIME (hour to second)
Timestamp IFX_TYPE_DTIME (year to fraction(5))
Tinyint IFX_TYPE_SMINT
Varbinary IFX_TYPE_BYTE
Varchar IFX_TYPE_VCHAR (n)
Nothing* IFX_TYPE_BOOL

1 This mapping is JDBC compliant. You can map the JDBC FLOAT data type to the HCL OneDB SMALLFLOAT data type for compatibility with earlier versions by setting the IFX_SET_FLOAT_AS_SMFLOAT connection property to 1.

To avoid mapping ambiguities, use the following extensions to CallableStatement, defined in the IfmxCallableStatement interface:
public void IfxRegisterOutParameter(int parameterIndex, 
   int ifxType) throws SQLException;

public void IfxRegisterOutParameter(int parameterIndex, 
   int ifxType, String name) throws SQLException;

public void IfxRegisterOutParameter(int parameterIndex, 
   int ifxType, int scale) throws SQLException;

public void IfxSetNull(int i, int ifxType) throws SQLException;

public void IfxSetNull(int i, int ifxType, String name) throws
   SQLException;

Possible values for the ifxType parameter are listed in The IfxTypes class.

HCL OneDB, Version 10.0, or later makes available to the JDBC client valid BLOB descriptors and data to support binary OUT parameters for SPL UDRs.

HCL OneDB JDBC Driver, Version 3.0, or later can receive the OUT parameter descriptor and data provided by the server and use it in Java™ applications.

The single correct return value for any JDBC binary type (BINARY, VARBINARY, LONGVARBINARY) retrieved via method getParameterType (ParameterMetaData) is -4, which is associated with java.sql.Type.LONGVARBINARY data type. This reflects the fact that all the JDBC binary types are mapped to the same HCL OneDB SQL data type, BYTE.