Home | Previous Page | Next Page   Appendix C. Mapping Data Types >

Data Type Mapping Between Informix and JDBC Data Types

Because there are variations between the SQL data types supported by each database vendor, the JDBC API defines a set of generic SQL data types in the class java.sql.Types. Use these JDBC API data types to reference generic SQL types in your Java programs that use the JDBC API to connect to Informix databases.

The following table shows the Informix data type to which each JDBC API data type maps.

JDBC API Data Type
Informix Data Type
BIGINT
INT8
BINARY
BYTE
BIT 1
BOOLEAN
REF
Not supported
CHAR
CHAR(n)
DATE
DATE
DECIMAL
DECIMAL
DOUBLE
FLOAT
FLOAT
FLOAT2
INTEGER
INTEGER
LONGVARBINARY
BYTE or BLOB
LONGVARCHAR
TEXT or CLOB
NUMERIC
DECIMAL
NUMERIC
MONEY
REAL
SMALLFLOAT
SMALLINT
SMALLINT
TIME
DATETIME HOUR TO SECOND2
TIMESTAMP
DATETIME YEAR TO FRACTION(5)3
TINYINT
SMALLINT
VARBINARY
BYTE
VARCHAR
VARCHAR(m,r)
BOOLEAN
BOOLEAN
SMALLINT
SMALLINT

1With Java 1.3.1, the JDBC 3.0 features are undefined. So if you are running Java 1.3.1, then the JDBC type java.sql.Types.OTHER will still map to BOOLEAN. If Java 1.4 is used, java.sql.Types.BOOLEAN maps to BOOLEAN.

2 This mapping is JDBC compliant. You can map the JDBC FLOAT data type to the Informix SMALLFLOAT data type for backward compatibility by setting the IFX_SET_FLOAT_AS_SMFLOAT environment variable to 1.

3 Informix DATETIME types are very restrictive and are not interchangeable. For more information, see Field Lengths and Date-Time Data.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]