DB2 Version 9.7 for Linux, UNIX, and Windows

Data conversions supported in CLI

Data type conversions supported by CLI.

The first column contains the data type of the SQL data type. The remaining columns represent the C data types. If the C data type columns contain:
D
The conversion is supported and this is the default conversion for the SQL data type.
X
All IBM® DBMSs support the conversion.
blank
No IBM DBMS supports the conversion.

See the tables of data type attributes (precision, scale, length, and display) for more information about the data type formats.

Table 1. Supported data conversions

SQL
data type

S
Q
L
_
C
_
C
H
A
R

S
Q
L
_
C
_
W
C
H
A
R

S
Q
L
_
C
_
B
I
N
A
R
Y
X
M
L

S
Q
L
_
C
_
D
B
C
H
A
R

S
Q
L
_
C
_
B
I
T

S
Q
L
_
C
_
T
I
N
Y
I
N
T

S
Q
L
_
C
_
S
T
I
N
Y
I
N
T

S
Q
L
_
C
_
U
T
I
N
Y
I
N
T

S
Q
L
_
C
_
S
H
O
R
T

S
Q
L
_
C
_
S
S
H
O
R
T

S
Q
L
_
C
_
U
S
H
O
R
T

S
Q
L
_
C
_
L
O
N
G

S
Q
L
_
C
_
S
L
O
N
G

S
Q
L
_
C
_
U
L
O
N
G

S
Q
L
_
C
_
S
B
I
G
I
N
T

S
Q
L
_
C
_
U
B
I
G
I
N
T

S
Q
L
_
C
_
F
L
O
A
T

S
Q
L
_
C
_
D
O
U
B
L
E

S
Q
L
_
C
_
N
U
M
E
R
I
C

S
Q
L
_
C
_
D
E
C
I
M
A
L
_
I
B
M

S
Q
L
_
C
_
D
E
C
I
M
A
L
6
4

S
Q
L
_
C
_
D
E
C
I
M
A
L
1
2
8

S
Q
L
_
C
_
T
Y
P
E
_
D
A
T
E

S
Q
L
_
C
_
T
Y
P
E
_
T
I
M
E

S
Q
L
_
C
_
T
Y
P
E
_
T
I
M
E
S
T
A
M
P

S
Q
L
_
C
_
D
A
T
A
L
I
N
K

S
Q
L
_
C
_
B
I
N
A
R
Y

S
Q
L
_
C
_
C
L
O
B
_
L
O
C
A
T
O
R

S
Q
L
_
C
_
B
L
O
B
_
L
O
C
A
T
O
R

S
Q
L
_
C
_
D
B
C
L
O
B
_
L
O
C
A
T
O
R

S
Q
L
_
C
_
C
U
R
S
O
R
H
A
N
D
L
E

SQL_CHAR

D

X

 

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

SQL_WCHAR4

D

X

 

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

SQL_
VARCHAR

D

X

 

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

SQL_
WVARCHAR4

D

X

 

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

SQL_
LONG
VARCHAR

D

X

 

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

SQL_
BINARY

X

X

 

D

SQL_
VARBINARY

X

X

 

D

SQL_
LONG
VARBINARY

X

X

 

D

SQL_
GRAPHIC

X

X

 

D

X

X

X

X

X

X

X

X

X

SQL_
VARGRAPHIC

X

X

 

D

X

X

X

X

X

X

X

X

X

SQL_
LONG
VARGRAPHIC

X

X

 

D

X

X

X

X

X

X

X

X

X

SQL_CLOB

D

X

 

X

X

SQL_BLOB

X

X

 

D

X

SQL_DBCLOB

X

X

 

D

X

X

SQL_
CLOB_
LOCATOR

 

D

SQL_
BLOB_
LOCATOR

 

D

SQL_
DBCLOB_
LOCATOR

 

D

SQL_NUMERIC

D

X

 

X5

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

SQL_DECIMAL

D

X

 

X5

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

SQL_DECFLOAT

D

X

 

X5

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

 

X

X

               

SQL_INTEGER

X

X

 

X5

X

X

X

X

X

X

X

D3

D3

X

X

X

X

X

X

X

X

X

SQL_
SMALLINT

X

X

 

X5

X

X

X

X

D2

D2

X

X

X

X

X

X

X

X

X

X

X

X

SQL_FLOAT

X

X

 

X5

X

X

X

X

X

X

X

X

X

X

X

X

X

D

X

X

X

X

SQL_DOUBLE

X

X

 

X5

X

X

X

X

X

X

X

X

X

X

X

X

X

D

X

X

X

X

SQL_REAL

X

X

 

X5

X

X

X

X

X

X

X

X

X

X

X

X

D

X

X

X

X

X

SQL_BIGINT

X

X

 

X5

X

X

X

X

X

X

X

X

X

X

D

X

X

X

X

X

X

X

SQL_TINYINT

X

X

 

X

D1

D1

X

X

X

X

X

X

X

X

X

X

X

X

X

X

X

SQL_BIT

X

X

 

D

SQL_
TYPE_DATE

X

X

 

D

X

SQL_
TYPE_TIME

X

X

 

D

X

SQL_
TYPE_
TIMESTAMP

X

X

 

X

X

D

SQL_XML

X

X

D

X

D

SQL_CURSORHANDLE

D6

Note:
  1. The C type SQL_C_TINYINT is treated by CLI as the type SQL_C_STINYINT so either type can be considered to be the default.
  2. The C type SQL_C_SHORT is treated by CLI as the type SQL_C_SSHORT so either type can be considered to be the default.
  3. The C type SQL_C_LONG is treated by CLI as the type SQL_C_SLONG so either type can be considered to be the default.
  4. This type is not supported in the DB2® database but other supported types can be returned to the client as this type because of the setting of a configuration keyword, such as MAPCharToWChar.
  5. This type conversion is restricted to Unicode.
  6. In Version 9.7 Fix Pack 6 and later fix packs, the SQL_C_CURSORHANDLE C data type is supported for use with the SQL_CURSORHANDLE SQL data type. Binding of the SQL_C_CURSORHANDLE C data type is supported with DB2 for Linux, UNIX, and Windows servers Version 9.7 and later.

In Version 9.7 Fix Pack 1 and later fix packs, the SQL_C_BINARYXML C data type is available for use with the binary XML data in DB2 for z/OS®. Starting in V9.7 Fix Pack 5, SQL_C_BINARYXML C data type can be used with binary XML data in DB2 for Linux, UNIX, and Windows. The DB2 server must also be at a level that supports the binary XML data type. The SQL_XML data type is not supported for use with an Informix® data server.

  • In Version 9.7 Fix Pack 5 and later fix packs, the SQL_XML data type is supported for DB2 for i Version 7 Release 1 servers or later releases.
  • In Version 9.7 Fix Pack 6 and later fix packs, SQL_BINARY and SQL_VARBINARY data types are supported for DB2 for i Version 6 Release 1 servers or later releases.