Nonextended data types

The following tables list the PreparedStatement.setXXX() methods that Informix® JDBC Driver supports for nonextended data types. The top heading lists the standard JDBC API data types defined in the java.sql.Types class. These translate to specific Informix data types, as shown in the table in Data type mapping between extended types and Java and JDBC types. The tables below list the setXXX() methods you can use to write data of a particular JDBC API data type. An uppercase and bold X indicates the setXXX() method that it is recommended you use with Informix JDBC Driver; a lowercase x indicates other setXXX() methods that Informix JDBC Driver supports.

Numeric JDBC API data types

Table 1. Numeric JDBC API data types from java.sql.Types
setXXX() method TINYINT SMALLINT INTEGER BIGINT
setByte() X x x x
setShort() x X x x
setInt() x x X x
setLong() x x x X
setFloat() x x x x
setDouble() x x x x
setBigDecimal() x x x x
setBoolean() x x x x
setString() x x x x
setObject() x x x x
Table 2. Numeric JDBC API data types from java.sql.Types (continued)
setXXX() method REAL FLOAT DOUBLE DECIMAL NUMERIC
setByte() x x x x x
setShort() x x x x x
setInt() x x x x x
setLong() x x x x x
setFloat() X x x x x
setDouble() x X X x x
setBigDecimal() x x x X X
setBoolean() x x x x x
setString() x x x x x
setObject() x x x x x

Character and chronological JDBC API data types

Table 3. Character and chronological JDBC API data types from java.sql.Types
setXXX() method CHAR VARCHAR LONGVARCHAR BINARY
setByte() x1 x1
setShort() x1 x1
setInt() x1 x1
setLong() x1 x1
setFloat() x1 x1
setDouble() x1 x1
setBigDecimal() x x
setBoolean() x x
setString() X X x x
setBytes() x X
setDate() x x
setTime() x x
setTimestamp() x x
setAsciiStream() X x
setCharacterStream() X x
setBinaryStream() x x
setObject() x x x2 x
Notes:
  1. The column value must match the type of setXXX() exactly, or an SQLException is raised. If the column value is not within the allowed value range, the setXXX() method raises an exception instead of converting the data type. For example, setByte(1) raises an SQLException if the value being written is 1000.
  2. A byte array is written.
Table 4. Character and chronological JDBC API data types from java.sql.Types (continued)
setXXX() method VARBINARY LONGVARBINARY DATE TIME TIMESTAMP
setString() x x x x x
setBytes() X x
setDate() X x
setTime() X x
setTimestamp() x X
setAsciiStream() x x
setCharacterStream() x x
setBinaryStream() x X
setObject() x x1 x x2 x
Notes:
  1. A byte array is written.
  2. A Timestamp object is written instead of a Time object.

The setMaxRows() method writes an SQL null value.