How SQL data types map to Java data types

SQL data type Java data type
VARCHAR, LONGVVARCHAR String
BIT boolean
TINYBIT byte
SMALLINT short
INTERGER int
BIGINT long
REAL float
DOUBLE double
VARBINARY, LONGVARBINARY byte[]
NUMERIC java.math.BigDecimal
DATE java.sql.Date
TIME java.sql.Time
TIMESTAMP java.sqlTimestamp

  • To get the SQL data type that's used in the column of a result set, uoy can use the getColumnType and getColumnTypeName methods of the ResultSetMetaData class.