With the exception of the data types listed in Unsupported JDBC Features, the Ingres JDBC Driver supports conversion of Ingres data values into Java/JDBC values as required by the JDBC specification.
Because Ingres does not support all the JDBC data types, the following conventions are used when sending Java/JDBC parameters to the DBMS:
Generally, NULL values sent to the DBMS are associated with the data type provided in the setNULL() or setObject() method call or the data type implied by the setXXX() method call. A generic or typeless NULL value can be sent to the DBMS using one of the following method calls:
setNull( idx, Types.NULL )
setObject( idx, null )
setObject( idx, null, Types.NULL )
Boolean values are sent to the DBMS as single byte integers with the value 0 or 1.
Long values are sent to the DBMS as DECIMAL (if supported by the DBMS) or DOUBLE values when BIGINT is not supported by the DBMS.
BigDecimal values are sent as DOUBLE values when DECIMAL is not supported by the DBMS. Avoid using the BigDecimal constructor that takes a parameter of type double. This constructor can produce decimal values that exceed the scale/precision supported by Ingres.
When ANSI date/time data types are not supported, Ingres supports a single date data type, which is used for DATE, TIME, and TIMESTAMP values. Ingres dates do support date without time values and this form is used for JDBC DATE values.
When ANSI date/time data types are not supported, Ingres supports a single date data type that is used for DATE, TIME, and TIMESTAMP values. Ingres dates do not support date without time values. The Ingres JDBC Driver adds the JDBC date epoch 1970-01-01 to JDBC TIME values. The Ingres DBMS adds the current date to time-only values.
Zero length CHAR values are sent as VARCHAR values. For conventions associated with NCS enabled databases, see National Character Set Columns. For information on automatic conversion to LONGVARCHAR, see the end of this section.
For conventions associated with NCS enabled databases, see National Character Set Columns. For information on automatic conversion to LONGVARCHAR, see the end of this section.
For conventions associated with NCS enabled databases, see National Character Set Columns.
Zero length BINARY values are sent as VARBINARY values.
In addition to the JDBC types listed above, the following conventions are used when certain Java data values are provided to the setObject() method:
Byte arrays are sent by default as VARBINARY values.
While not required by JDBC, character arrays are supported by the Ingres JDBC Driver and are sent by default as CHAR values. For conventions associated with NCS enabled databases, see National Character Set Columns. For information on automatic conversion to LONGVARCHAR, see the end of this section.
Strings are sent by default as VARCHAR values. For conventions associated with NCS enabled databases, see National Character Set Columns. For information on automatic conversion to LONGVARCHAR, see the end of this section.
While not required by JDBC, InputStream objects are supported by the Ingres JDBC Driver and are sent by default as LONGVARBINARY values.
While not required by JDBC, Reader objects are supported by the Ingres JDBC Driver and are sent by default as LONGVARCHAR values. For conventions associated with NCS enabled databases, see National Character Set Columns.
JDBC requires BINARY, VARBINARY, CHAR, and VARCHAR parameter values to be converted to LONGVARBINARY/LONGVARCHAR when their length exceeds some DBMS dependent maximum.
The default maximum used by the Ingres JDBC driver is 2000 bytes. This default maximum value can be incorrect for an Ingres database that has been configured with non-default page sizes and for EDBC or Enterprise Access gateways.
The Ingres driver uses the following entries in the iidbcapabilities system catalog to determine at runtime the appropriate size limits:
SQL_MAX_BYTE_COLUMN_LEN
SQL_MAX_VBYT_COLUMN_LEN
SQL_MAX_CHAR_COLUMN_LEN
SQL_MAX_VCHR_COLUMN_LEN
Not all releases of the Ingres DBMS, EDBC, and Enterprise Access gateways have these entries in their iidbcapabilities system catalogs. These entries can be entered manually to provide accurate size information for the Ingres driver. Depending on the DBMS involved, special permissions are required to update the system catalog.