Wednesday, April 10, 2013

Oracle JDBC Mapping

SQL and PL/SQL Data TypeOracle MappingJDBC Mapping
CHARCHARACTERLONGSTRINGVARCHARVARCHAR2
oracle.sql.CHAR
java.lang.String
NCHARNVARCHAR2
oracle.sql.NCHAR (note 1)
oracle.sql.NString (note 1)
NCLOB
oracle.sql.NCLOB (note 1)
oracle.sql.NCLOB (note 1)
RAWLONG RAW
oracle.sql.RAW
byte[]
BINARY_INTEGERNATURALNATURALNPLS_INTEGERPOSITIVEPOSITIVEN,SIGNTYPEINTINTEGER
oracle.sql.NUMBER
int
DECDECIMALNUMBERNUMERIC
oracle.sql.NUMBER
java.math.BigDecimal
DOUBLE PRECISIONFLOAT
oracle.sql.NUMBER
double
SMALLINT
oracle.sql.NUMBER
int
REAL
oracle.sql.NUMBER
float
DATE
oracle.sql.DATE
java.sql.Timestamp
TIMESTAMP
TIMESTAMP WITH TZ
TIMESTAMP WITH LOCAL TZ
oracle.sql.TIMESTAMP
oracle.sql.TIMESTAMPTZ
oracle.sql.TIMESTAMPLTZ
java.sql.Timestamp
INTERVAL YEAR TO MONTH
INTERVAL DAY TO SECOND
String (note 2)
String (note 2)
ROWIDUROWID
oracle.sql.ROWID
oracle.sql.ROWID
BOOLEAN
boolean (note 3)
boolean (note 3)
CLOB
oracle.sql.CLOB
java.sql.Clob
BLOB
oracle.sql.BLOB
java.sql.Blob
BFILE
oracle.sql.BFILE
oracle.sql.BFILE
Object types
Generated class
Generated class
SQLJ object types
Java class defined at type creation
Java class defined at type creation
OPAQUE types
Generated or predefined class (note 4)
Generated or predefined class (note 4)
RECORD types
Through mapping to SQL object type (note 5)
Through mapping to SQL object type (note 5)
Nested table, VARRAY
Generated class implemented usingoracle.sql.ARRAY
java.sql.Array
Reference to object type
Generated class implemented usingoracle.sql.REF
java.sql.Ref
REF CURSOR
java.sql.ResultSet
java.sql.ResultSet
Index-by tables
Through mapping to SQL collection (note 6)
Through mapping to SQL collection (note 6)
Scalar (numeric or character)
Index-by tables
Through mapping to Java array (note 7)
Through mapping to Java array (note 7)