The conceptual mapping between JDBC types and Java types is shown in the following table. The Open SQL programmer should consider this mapping when writing code. For example, if a value in the database is SMALLINT, a short should be the data type used as output or input host variable of a SQL statement.
JDBC Type |
Java Type |
---|---|
VARCHAR |
String |
LONGVARCHAR |
String |
CLOB |
java.sql.Clob |
BINARY |
byte[] |
LONGVARBINARY |
byte[] |
BLOB |
java.sql.Blob |
SMALLINT |
Short |
INTEGER |
Integer |
BIGINT |
Long |
REAL |
Float |
DOUBLE |
Double |
DECIMAL |
java.math.BigDecimal |
DATE |
java.sql.Date |
TIME |
java.sql.Time |
TIMESTAMP |
java.sql.Timestamp |