Table 25. Mappings of Java data types to database server data types for updating database tables (continued)
Java data type Database data type
java.sql.Blob BLOB
java.sql.Blob XML
10
java.sql.Clob CLOB
java.sql.Clob DBCLOB
9
java.sql.Clob XML
10
java.sql.Date DATE
java.sql.Time TIME
java.sql.Timestamp TIMESTAMP
java.io.ByteArrayInputStream BLOB
java.io.StringReader CLOB
java.io.ByteArrayInputStream CLOB
java.io.InputStream XML
10
com.ibm.db2.jcc.DB2RowID (deprecated) ROWID
java.sql.RowId ROWID
com.ibm.db2.jcc.DB2Xml (deprecated) XML
10
java.sql.SQLXML XML
10
Notes:
1. The database server has no exact equivalent for the Java boolean or byte data types, but the best fit is
SMALLINT.
2. p is the decimal precision and s is the scale of the table column.
You should design financial applications so that java.math.BigDecimal columns map to DECIMAL columns. If
you know the precision and scale of a DECIMAL column, updating data in the DECIMAL column with data in a
java.math.BigDecimal variable results in better performance than using other combinations of data types.
3. n=16 or n=34.
4. DECFLOAT is valid for connections to DB2 Version 9.1 for z/OS, DB2 V9.5 for Linux, UNIX, and Windows, or
DB2 for i V6R1, or later database servers. Use of DECFLOAT requires the SDK for Java Version 5 (1.5) or later.
5. n<=255.
6. m<=127.
7. n<=32704.
8. m<=16352.
9. This mapping is valid only if the database server can determine the data type of the column.
10. XML is valid for connections to DB2 Version 9.1 for z/OS or later database servers or DB2 V9.1 for Linux, UNIX,
and Windows or later database servers.
11. BIGINT is valid for connections to DB2 Version 9.1 for z/OS or later database servers, DB2 V9.1 for Linux,
UNIX, and Windows or later database servers, and all supported DB2 for i database servers.
12. BINARY and VARBINARY are valid for connections to DB2 Version 9.1 for z/OS or later database servers, DB2
V9.1 for Linux, UNIX, and Windows or later database servers, or DB2 for i5/OS V5R3 and later database
servers.
Data types for retrieval from table columns
The following table summarizes the mappings of DB2 or IDS data types to Java
data types for ResultSet.getXXX methods in JDBC programs, and for iterators in
SQLJ programs. This table does not list Java numeric wrapper object types, which
are retrieved using ResultSet.getObject.
194 Application Programming Guide and Reference for Java
â„¢
|
|
|
|
|
|
|