IBM Informix Embedded SQLJ User's Guide

######

IBM Informix Embedded SQLJ User's Guide Chapter 4: The Embedded SQLJ Language

Contents | Index |  |

## SQL and Java Type Mappings When you retrieve data from a database into an iterator object (see "Handling 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
--- | ---
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, IfxIntervalYM *
LVARCHAR | String
MONEY | java.math.BigDecimal
NCHAR, NVARCHAR | String
SERIAL | int
SERIAL8 | long
SMALLFLOAT | double
SMALLINT | short
TEXT | String
VARCHAR | String
* IfxIntervalYM and IfxIntervalDF are Informix extensions to JDBC 2.0.
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 | FLOAT
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
| 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.

IBM Informix Embedded SQLJ User's Guide, Version 1.0
Copyright © 1999, IBM Corporation. All rights reserved.