SQL and Java type mappings

When you retrieve data from a database into an iterator object (see Result sets) or into a host variable, you must use Java types that are compatible with the SQL types. The following table shows valid conversions from SQL types to Java types.
SQL type Java type
BIGINT, BIGSERIAL bigint
BLOB byte[]
BOOLEAN boolean
BYTE byte[]
CHAR, CHARACTER String
CHARACTER VARYING String
CLOB byte[]
DATE java.sql.Date
DATETIME java.sql.Timestamp
DECIMAL, NUMERIC, DEC java.math.BigDecimal
FLOAT, DOUBLE PRECISION double
INT8 long
INTEGER, INT int
INTERVAL IfxIntervalDF, IfxIntervalYM1
LVARCHAR String
MONEY java.math.BigDecimal
NCHAR, NVARCHAR String
SERIAL int
SERIAL8 long
SMALLFLOAT float2
SMALLINT short
TEXT String
VARCHAR String
Table notes:
  1. IfxIntervalYM and IfxIntervalDF are HCL Informix® extensions to JDBC 2.0.
  2. This mapping is JDBC compliant. You can use Informix® JDBC Driver to map SMALLFLOAT data type (via the JDBC FLOAT data type) to the Java double data type for backward compatibility by setting the IFX_GET_SMFLOAT_AS_FLOAT environment variable to 1.
You must also use compatible Java types for host variables that are arguments to SQL operations. This table shows valid conversions from Java types to SQL types.
Java type SQL type
java.math.BigDecimal DECIMAL
boolean BOOLEAN
byte[] BYTE
java.sql.Date DATE
double FLOAT1
float SMALLFLOAT
int INT
long INT8
short SMALLINT
String CHAR
java.sql.Time DATETIME
java.sql.Timestamp DATETIME
com.informix.jdbc.IfxIntervalDF INTERVAL
com.informix.jdbc.IfxIntervalYM INTERVAL
Table note:
  1. This mapping is JDBC compliant. You can use Informix® JDBC Driver to map the Java double data type (via the JDBC FLOAT data type) to the HCL Informix® SMALLFLOAT data type for backward compatibility by setting the IFX_GET_SMFLOAT_AS_FLOAT environment variable to 1.
Important: Unlike other host languages (for example, C), Java allows null data. Therefore, you do not need to use null indicator variables with Embedded SQLJ. The Java null value is equivalent to the SQL NULL value.