DB2 Data Types

The following table contains the available data types for DB2 databases supported by CONNX.

 

CONNX Data Type

SQL Data Type

Length

ODBC Data Type

Description

DB2 Eur Date (dd.mm.yyyy)

Date

10

SQL_DATE

 

DB2 Eur Time (hh.mm.ss.)

Time

8

SQL_TIME

 

DB2 IEEE 4-byte float

Real

4

SQL_REAL

4-byte byte-reversed (little endian) IEEE float

DB2 IEEE 8-byte float

Double

8

SQL_DOUBLE

8-byte byte-reversed (little endian) IEEE float

DB2 IEEE Big E 4-byte float

Real

4

SQL_REAL

4-byte big endian IEEE float

DB2 IEEE Big E 8-byte float

Double

8

SQL_DOUBLE

8-byte big endian IEEE float

DB2 ISO Date (YYYY-MM-DD)

Date

10

SQL_DATE

ISO DATE column

DB2 ISO Time (hh.mm.ss)

Time

8

SQL_TIME

ISO TIME column

DB2 JIS Date (YYYY-MM-DD)

Date

10

SQL_DATE

 

DB2 JIS Time (hh:mm:ss)

Time

8

SQL_TIME

 

DB2 Longword Big Endian

Integer

4

SQL_INTEGER

 

DB2 Longword Integer

Integer

4

SQL_INTEGER

4-byte signed long integer (-2147483648 thru +2147483647)

DB2 Mainframe 4-byte float

Real

4

SQL_REAL

Mainframe DB2 (MVS or OS/390) 4-byte float

DB2 Mainframe 8-byte float

Double

8

SQL_DOUBLE

Mainframe DB2 (MVS or OS/390) 8-byte float

DB2 Numeric

Numeric

1-31

SQL_NUMERIC

Zoned numeric columns defined as NUMERIC (precision, scale), where precision >= scale; 0 <= precision <=31; 0 <= scale <=31

DB2 Numeric Integer

Numeric

9

SQL_DECIMAL

Describes an SQL NUMERIC display column with a scale = 0 and precision < = 9, e.g., NUMERIC (9,0). The default conversion from host column to ODBC data type is from SQL_NUMERIC to signed long integer = SQL_C_SLONG.

DB2 Packed Decimal

Decimal

1-16

SQL_DECIMAL

Packed decimal columns defined as DECIMAL (precision, scale), where precision >= scale; 0 <= precision <=31; 0 <= scale <=31

DB2 Packed Decimal Integer

Decimal

9

SQL_DECIMAL

This data type corresponds to an SQL_DECIMAL column with a scale of 0 and a precision < = 9, e.g., DECIMAL(9,0). The default conversion from host column to ODBC data type is from SQL_DECIMAL to signed long integer = SQL_C_SLONG.

DB2 Small Integer

Smallint

2

SQL_SMALLINT

2-byte signed small integer (-32768 thru +32767)

DB2 Timestamp

Timestamp

26

SQL_TIMESTAMP

ISO Timestamp column (YYYY-MM-DD -HH.MM.SS.123456)

DB2 Text (Null Terminated)

Varchar

255-32767

SQL_VARCHAR

255+ byte variable-length binary (defined as VARCHAR/LONG VARCHAR)

DB2 Text (Right Space Padded)

Char

1-254

SQL_CHAR

1- to 254-byte fixed-length character

DB2 USA Date (mm/dd/yyyy)

Date

10

SQL_DATE

 

DB2 USA Time (hh:mm xM)

Time

8

SQL_TIME

 

DB2 Varbinary

Varbinary

255-32767

SQL_VARBINARY

255+ byte variable-length binary (defined as VARCHAR/LONG VARCHAR FOR BIT DATA)

DB2 Word Big Endian

SmallInt

2

SQL_SMALLINT

 

Double Prec float (Mainframe)

Double

8

SQL_DOUBLE

 

Longword 4 bytes

Integer

4

SQL_INTEGER

 

Longword (BE) -> Double

Double

4

SQL_DOUBLE

 

Longword (BE) -> Decimal

Decimal

4

SQL_DECIMAL

 

Single Prec float (Mainframe)

Real

4

SQL_REAL

 

Text (Right Space Padded)

Char

-1

SQL_CHAR

 

Text DB2 (Right Space Padded)

Char

-1

SQL_CHAR

 

Text DB2 (Null Terminated)

VarChar

-1

SQL_VARCHAR

 

Unsigned Long (BE) -> Decimal

Decimal

2

SQL_DECIMAL

 

Unsigned Word (BE) -> Decimal

Decimal

2

SQL_DECIMAL

 

Unsigned Long (BE) -> Double

Double

4

SQL_DOUBLE

 

Unsigned Word (BE) -> Double

Double

2

SQL_DOUBLE

 

Word 2 bytes

SmallInt

2

SQL_SMALLINT

 

Word (BE) -> Decimal

Decimal

2

SQL_DECIMAL

 

Word (BE) -> Double

Double

2

SQL_DOUBLE