Field lengths and date-time data

When you set a field type to a date-time or interval data type by calling setFieldType(IFX_TYPE_DATETIME) or setFieldType(IFX_TYPE_INTERVAL), the driver maps the date-time field to either java.sql.Timestamp or java.sql.Time, depending on the encoded length you set by calling setFieldLength().

For example, given that the standard format for a date-time field is YYYY-MM-DD HH:MM:SS, the driver uses the following mapping algorithm:
  • If the encoded length has the start code from hour or less, it is mapped to java.sql.Time.
  • If the encoded length has the start code from year or less, it is mapped to java.sql.TimeStamp.
For intervals, the standards are either YYYY-MM or DD HH:MM:SS.frac. The mapping is as follows:
  • If the encoded length has the start code from day or less, it is mapped to com.informix.jdbc.IfxIntervalDF.
  • If the encoded length has the start code from year or less, it is mapped to com.informix.jdbc.IfxIntervalYM.