Supported SQL data types in DB2GENERAL routines
When you call PARAMETER STYLE DB2GENERAL routines, SQL types are converted to and from Java™ types.
Several of these classes are provided in the Java package COM.ibm.db2.app
.
SQL Column Type | Java Data Type |
---|---|
SMALLINT | short |
INTEGER | int |
BIGINT | long |
REAL1 | float |
DOUBLE | double |
DECIMAL(p,s) | java.math.BigDecimal |
NUMERIC(p,s) | java.math.BigDecimal |
CHAR(n) | java.lang.String |
CHAR(n) FOR BIT DATA | COM.ibm.db2.app.Blob |
VARCHAR(n) | java.lang.String |
VARCHAR(n) FOR BIT DATA | COM.ibm.db2.app.Blob |
LONG VARCHAR | java.lang.String |
LONG VARCHAR FOR BIT DATA | COM.ibm.db2.app.Blob |
GRAPHIC(n) | java.lang.String |
VARGRAPHIC(n) | String |
LONG VARGRAPHIC2 | String |
BINARY | COM.ibm.db2.app.Blob |
VARBINARY | COM.ibm.db2.app.Blob |
BLOB(n)2 | COM.ibm.db2.app.Blob |
CLOB(n)2 | COM.ibm.db2.app.Clob |
DBCLOB(n)2 | COM.ibm.db2.app.Clob |
DATE3 | String |
TIME3 | String |
TIMESTAMP3 | String |
Note:
|
Instances of classes COM.ibm.db2.app.Blob
and COM.ibm.db2.app.Clob
represent
the LOB data types (BLOB, CLOB, and DBCLOB). These classes provide
a limited interface to read LOBs passed as inputs, and write LOBs
returned as outputs. Reading and writing of LOBs occur through standard Java I/O stream objects. For the
Blob class, the routines getInputStream()
and getOutputStream()
return
an InputStream or OutputStream object through which the BLOB content
can be processed bytes-at-a-time. For a Clob, the routines getReader()
and getWriter()
will
return a Reader or Writer object through which the CLOB or DBCLOB
content can be processed characters-at-a-time.
If such an object is returned as an output using the set() method, code page conversions might be applied in order to represent the Java Unicode characters in the database code page.