Oracle8i JDBC Developer's Guide and Reference Release 3 (8.1.7) Part Number A83724-01 |
|
When JDBC programs retrieve SQL data into Java, you can use standard Java types, or you can use types of the oracle.sql
package. The classes in this package simply wrap the raw SQL data.
In processing speed and effort, the oracle.sql.*
classes provide the most efficient way of representing SQL data. These classes store the usual representations of SQL data as byte arrays. They do not reformat the data or perform any character-set conversions (aside from the usual network conversions) on it. The data remains in SQL format, and therefore no information is lost. For SQL primitive types (such as NUMBER
, and CHAR
), the oracle.sql.*
classes simply wrap the SQL data. For SQL structured types (such as objects and arrays), the classes provide additional information such as conversion methods and structure details.
If you are moving data within the database, then you will probably want to keep your data in oracle.sql.*
format. If you are displaying the data or performing calculations on it in a Java application running outside the database, then you will probably want to materialize the data as instances of standard types such as java.sql.*
or java.lang.*
types. Similarly, if you are using a parser that expects the data to be in a standard Java format, then you must use one of the standard formats instead of oracle.sql.*
format.
Java represents a SQL NULL
datum by the Java value null
. Java datatypes fall into two categories: primitive types (such as byte
, int
, float
) and object types (class instances). The primitive types cannot represent null
. Instead, they store the null as the value zero (as defined by the JDBC specification). This can lead to ambiguity when you try to interpret your results.
In contrast, Java object types can represent null
. The Java language defines an object wrapper type corresponding to every primitive type (for example, Integer
for int
, Float
for float
) that can represent null
. The object wrapper types must be used as the targets for SQL data to detect SQL NULL
without ambiguity.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|