Oracle8i JDBC Developer's Guide and Reference
Release 8.1.5

A64685-01

Library

Product

Contents

Index

Prev  Chap Top Next

Valid SQL-JDBC Datatype Mappings

Table 3-1 and Table 3-2 in Chapter 3 describe the default mappings between Java classes and SQL datatypes that are supported by the Oracle JDBC drivers. Compare the contents of the Standard JDBC Datatypes, Java Native Datatypes and Oracle SQL Datatypes columns in Table 3-1 and Table 3-2 with the contents of Table 8-1 below.

Table 8-1 lists all of the possible Java classes to which a given SQL datatype can be validly mapped. The Oracle JDBC drivers will support these "non-default" mappings. For example, to materialize SQL CHAR data as an oracle.sql.CHAR, use getCHAR(). To materialize it as a java.math.BigDecimal, use getBigDecimal().

Table 8-1 Valid SQL Datatype-Java Class Mappings
This SQL datatype:   Can be materialized as these Java classes:  

CHAR, NCHAR,VARCHAR2,  

oracle.sql.CHAR  

NVARCHAR2, LONG  

java.lang.String  

 

java.sql.Date  

 

java.sql.Time  

 

java.sql.Timestamp  

 

java.lang.Byte  

 

java.lang.Short  

 

java.lang.Integer  

 

java.lang.Long  

 

java.lang.Float  

 

java.lang.Double  

 

java.math.BigDecimal  

 

byte, short, int, long, float, double  

DATE  

oracle.sql.DATE  

 

java.sql.Date  

 

java.sql.Time  

 

java.sql.Timestamp  

 

java.lang.String  

NUMBER  

oracle.sql.NUMBER  

 

java.lang.Byte  

 

java.lang.Short  

 

java.lang.Integer  

 

java.lang.Long  

 

java.lang.Float  

 

java.lang.Double  

 

java.math.BigDecimal  

 

byte, short, int, long, float, double  

RAW, LONG RAW  

oracle.sql.RAW  

 

byte[]  

ROWID  

oracle.sql.CHAR  

 

oracle.sql.ROWID  

 

java.lang.String  

BFILE  

oracle.sql.BFILE  

BLOB  

oracle.sql.BLOB  

 

oracle.jdbc2.Blob  

CLOB, NCLOB  

oracle.sql.CLOB  

 

oracle.jdbc2.Clob  

OBJECT  

oracle.sql.STRUCT  

 

oracle.SqljData  

 

oracle.jdbc2.Struct  

REF  

oracle.sql.REF  

 

oracle.jdbc2.Ref  

TABLE (nested), VARRAY  

oracle.sql.ARRAY  

 

oracle.jdbc2.Array  

any of the above SQL types  

oracle.sql.CustomDatum or oracle.sql.Datum  


Notes:

  • The type UROWID is not supported.

  • oracle.sql.Datum is an abstract class. The value passed to a parameter of type oracle.sql.Datum must be of the Java type corresponding to the SQL type. Likewise, the value returned by a method with return type oracle.sql.Datum must be of the Java type corresponding to the SQL type.

  • The mappings to oracle.sql classes are optimal if no conversion from SQL format to Java format is necessary.

 




Prev

Top

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index