JDBC provides support for almost all the SQL datatypes Whenever the JDBC driver receives a call from a Java application it converts the Java datatypes in it to the corresponding SQL data types. The conversion process follows default mapping. Following is the list of data types supported by JDBC and their corresponding SQL datatypes.
SQL | JDBC/Java |
---|---|
VARCHAR | java.lang.String |
CHAR | java.lang.String |
LONGVARCHAR | java.lang.String |
BIT | boolean |
NUMERIC | java.math.BigDecimal |
TINYINT | byte |
SMALLINT | short |
INTEGER | int |
BIGINT | long |
REAL | float |
FLOAT | float |
DOUBLE | double |
VARBINARY | byte[ ] |
BINARY | byte[ ] |
DATE | java.sql.Date |
TIME | java.sql.Time |
TIMESTAMP | java.sql.Timestamp |
CLOB | java.sql.Clob |
BLOB | java.sql.Blob |
ARRAY | java.sql.Array |
REF | java.sql.Ref |
STRUCT | java.sql.Struct |