Nonextended data types

The following tables list the ResultSet.getXXX() 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 first table in Data type mapping between Informix and JDBC data types. The tables list the getXXX() methods you can use to retrieve data of a particular JDBC API data type.

An uppercase and bold X indicates the recommended getXXX() method to use; a lowercase x indicates other getXXX() methods supported by Informix JDBC Driver.

Numeric JDBC API data types

Table 1. Numeric JDBC API data types from java.sql.Types
getXXX() method TINYINT SMALLINT INTEGER BIGINT
getByte() X x x x
getShort() x X x x
getInt() x x X x
getLong() x x x X
getFloat() x x x x
getDouble() x x x x
getBigDecimal() x x x x
getBoolean() x x x x
getString() x x x x
getObject() x x x x
Table 2. Numeric JDBC API data types from java.sql.Types (continued)
getXXX() method REAL FLOAT DOUBLE DECIMAL NUMERIC
getByte() x x x x x
getShort() x x x x x
getInt() x x x x x
getLong() x x x x x
getFloat() X x x x x
getDouble() x X X x x
getBigDecimal() x x x X X
getBoolean() x x x x x
getString() x x x x x
getObject() 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
getXXX() method CHAR VARCHAR LONGVARCHAR BINARY
getByte() x1 x1
getShort() x1 x1
getInt() x1 x1
getLong() x1 x1
getFloat() x1 x1
getDouble() x1 x1
getBigDecimal() x x
getBoolean() x x
getString() X X x x
getBytes() x x x X
getDate() x x
getTime() x x
getTimestamp() x x
getAsciiStream() X x
getCharacterStream() X x
getBinaryStream() x x
getObject() x x x2 x
Notes:
  1. The column value must match the type of getXXX() exactly, or an SQLException is raised. If the column value is not within the allowed value range, the getXXX() method raises an exception instead of converting the data type. For example, getByte(1) raises an SQLException if the column value is 1000.
  2. A byte array is returned.
Table 4. Character and chronological JDBC API data types from java.sql.Types (continued)
getXXX() method VARBINARY LONGVARBINARY DATE TIME TIMESTAMP
getString() x x x x x
getBytes() X x
getDate() X x
getTime() X x
getTimestamp() x X
getAsciiStream() x x
getCharacterStream() x x
getBinaryStream() x X
getObject() x x1 x x2 x
Notes:
  1. A byte array is returned.
  2. A Timestamp object is returned instead of a Time object.