JDBC is permissive. It lets you use java.sql.ResultSet.getFloat to
retrieve an int, java.sql.ResultSet.getObject to retrieve any type, and
so on. (java.sql.ResultSet and java.sql.CallableStatement provide
getXXX methods, and java .sql.PreparedStatement and
java.sql.CallableStatement provide setXXX methods.) This
permissiveness is convenient but expensive in terms of performance.
The following table shows the recommended getXXX methods for given
java.sql (JDBC) types, and their corresponding SQL types.
Mapping of java.sql.Types to SQL types
This table shows the recommended getXXX methods for given JDBC types, and their corresponding SQL types.
Recommended getXXX Method
java.sql.Types
SQL Types
getLong
BIGINT
BIGINT
getBytes
BINARY
CHAR FOR BIT DATA
getBlob
BLOB
BLOB
getString
CHAR
CHAR
getClob
CLOB
CLOB
getDate
DATE
DATE
getBigDecimal
DECIMAL
DECIMAL
getDouble
DOUBLE
DOUBLE PRECISION
getDouble
FLOAT
DOUBLE PRECISION
getInt
INTEGER
INTEGER
getBinaryStream
LONGVARBINARY
LONG VARCHAR FOR BIT DATA
getAsciiStream, getUnicodeStream
LONGVARCHAR
LONG VARCHAR
getBigDecimal
NUMERIC
DECIMAL
getFloat
REAL
REAL
getShort
SMALLINT
SMALLINT
getTime
TIME
TIME
getTimestamp
TIMESTAMP
TIMESTAMP
getBytes
VARBINARY
VARCHAR FOR BIT DATA
getString
VARCHAR
VARCHAR
None supported. You must use XMLSERIALIZE and then the
corresponding getXXX method.
SQLXML
XML