Use the appropriate getXXX and setXXX methods for the type

For performance reasons, use the recommended getXXX method when retrieving values, and use the recommended setXXX method when setting values for parameters.

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.
Table 1. Mapping of java.sql.Types to 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
Related concepts
Use prepared statements with substitution parameters
Create indexes, and make sure they are being used
Increase the size of the data page cache
Tune the size of database pages
Avoid expensive queries
Tune database booting/class loading
Avoid inserts in autocommit mode if possible
Customize the optimizer methods for table functions