Oracle8i JDBC Developer's Guide and Reference Release 3 (8.1.7) Part Number A83724-01 |
|
The Oracle JDBC drivers support standard JDBC 1.0 and 2.0 types as well as Oracle-specific BFILE
and ROWID
datatypes and types of the REF CURSOR
category.
This section documents standard and Oracle-specific SQL-Java default type mappings.
For reference, Table 3-2 shows the default mappings between SQL datatypes, JDBC typecodes, standard Java types, and Oracle extended types.
The SQL Datatypes column lists the SQL types that exist in the database.
The JDBC Typecodes column lists data typecodes supported by the JDBC standard and defined in the java.sql.Types
class, or by Oracle in the oracle.jdbc.driver.OracleTypes
class. For standard typecodes, the codes are identical in these two classes.
The Standard Java Types column lists standard types defined in the Java language.
The Oracle Extension Java Types column lists the oracle.sql.*
Java types that correspond to each SQL datatype in the database. These are Oracle extensions that let you retrieve all SQL data in the form of a oracle.sql.*
Java type. Mapping SQL datatypes into the oracle.sql
datatypes lets you store and retrieve data without losing information. Refer to "Package oracle.sql" for more information on the oracle.sql.*
package.
For a list of all the Java datatypes to which you can validly map a SQL datatype, see "Valid SQL-JDBC Datatype Mappings".
See Chapter 6, "Overview of Oracle Extensions", for more information on type mappings. In Chapter 6 you can also find more information on the following:
oracle.sql
, oracle.jdbc.driver
, and oracle.jdbc2
BFILE
and ROWID
datatypes and user-defined types of the REF
CURSOR
category
This section goes into further detail regarding mappings for NUMBER
and user-defined types.
User-defined types such as objects, object references, and collections map by default to weak Java types (such as java.sql.Struct
), but alternatively can map to strongly typed custom Java classes. Custom Java classes can implement one of two interfaces:
java.sql.SQLData
(for user-defined objects only)
oracle.sql.CustomDatum
(primarily for user-defined objects, object references, and collections, but able to map from any SQL type where you want customized processing of any kind)
For information about custom Java classes and the SQLData
and CustomDatum
interfaces, see "Mapping Oracle Objects" and "Creating and Using Custom Object Classes for Oracle Objects". (Although these sections focus on custom Java classes for user-defined objects, there is some general information about other kinds of custom Java classes as well.)
For the different typecodes that an Oracle NUMBER
value can correspond to, call the getter routine that is appropriate for the size of the data for mapping to work properly. For example, call getByte()
to get a Java tinyint
value, for an item x
where -128 < x < 128.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|