INFORMIX
Informix JDBC Driver Programmer's Guide
Chapter 2: Programming with Informix JDBC Driver
Contents Index

Mapping Data Types

This section discusses mapping issues between data types defined in a Java program and the data types supported by the Informix database server. In particular it covers the following two topics:

Mapping Between Informix and JDBC Data Types

Since there are variations between the SQL data types supported by each database vendor, the JDBC API defines a set of generic SQL data types in the class java.sql.Types. Use these JDBC API data types to reference generic SQL types in your Java programs that use the JDBC API to connect to Informix databases.

The following table shows the Informix data type to which each JDBC API data type maps.
JDBC API Data Type from java.sql.Types Corresponding Informix Data Type

BIGINT

INT8

BINARY

BYTE

BIT

Not supported

CHAR

CHAR(n)

DATE

DATE

DECIMAL

DECIMAL

DOUBLE

FLOAT

FLOAT

SMALLFLOAT

INTEGER

INTEGER

LONGVARBINARY

BYTE

LONGVARCHAR

TEXT

NUMERIC

DECIMAL

REAL

SMALLFLOAT

SMALLINT

SMALLINT

TIME

DATETIME

TIMESTAMP

DATETIME

TINYINT

SMALLINT

VARBINARY

BYTE

VARCHAR

VARCHAR(m,r)

Supported ResultSet.getXXX() Methods

Use the ResultSet.getXXX() methods to transfer data from an Informix database to a Java program that uses the JDBC API to connect to an Informix database. For example, use the ResultSet.getString() method to get the data stored in a column of data type LVARCHAR.

The following table "JDBC API Data Types from java.sql.Types" lists the ResultSet.getXXX() methods that Informix JDBC Driver supports. 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 on page 2-22. The left heading in the table lists the getXXX() methods you can use to retrieve data of a particular JDBC API data type.

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




Informix JDBC Driver Programmer's Guide, Version 1.22
Copyright © 1998, Informix Software, Inc. All rights reserved.