Mapping Database Field Types to Java Types in the Database Control

This topic describes the relationships between database field types and Java types in the Database control. To learn about the Database control, see Database Control: Using a Database from Your Web Service.

Type mappings are given for the PointBase database, which is installed with WebLogic Server, and for Oracle 8i. If you are using a different database, please consult the documentation for the JDBC driver of your database software.

Materialization

The process of converting a value retrieved from a database to a concrete Java type is referred to as materializing the value. It is possible for a database element to be materialized into many types. For example, one could imagine an INTEGER database value being materialized into all the following primitive types and classes: int, Integer, BigDecimal, float, Float, double, Double, String and possibly others.

Each database vendor defines a specific set of materializations that are supported by their database systems. If you attempt to perform a materialization that is not allowed by the database system you are accessing, an exception will be thrown.

The type mappings shown in the tables below are the most direct mappings and are shown as examples. Please consult the documentation for your database system to determine all possible database type to Java type mappings in the database system you are using.

Type Mappings for PointBase

The following table lists the relationships between database types and Java types for the PointBase Version 4.1 database.

Java Data Types
JDBC Data Types
PointBase SQL Data Types (Version 4.1)
boolean
BIT
boolean
byte
TINYINT
smallint
short
SMALLINT
smallint
int
INTEGER
integer
long
BIGINT
numeric/decimal
 
 
 
double
FLOAT
float
float
REAL
real
double
DOUBLE
double
 
 
 
java.math.BigDecimal
NUMERIC
numeric
java.math.BigDecimal
DECIMAL
decimal
 
 
 
String
CHAR
char
String
VARCHAR
varchar
String
LONGVARCHAR
clob
 
 
 
java.sql.Date
DATE
date
java.sql.Time
TIME
time
java.sql.Timestamp
TIMESTAMP
timestamp
 
 
 
byte[]
BINARY
blob
byte[]
VARBINARY
blob
byte[]
LONGVARBINARYbyte[]
blob
 
 
 
java.sql.Blob
BLOB
blob
java.sql.Clob
CLOB
clob
 
 
 

Type Mappings for Oracle 8i

The following table lists the relationships between database types and Java types for the Oracle 8i database.

Java Data Types
JDBC Data Types
Oracle SQL Data Types (Version 8i)
boolean
BIT

NUMBER

byte
TINYINT
NUMBER
short
SMALLINT
NUMBER
int
INTEGER
NUMBER
long
BIGINT
NUMBER
 
 
 
double
FLOAT
NUMBER
float
REAL
NUMBER
double
DOUBLE
NUMBER
 
 
 
java.math.BigDecimal
NUMERIC
NUMBER
java.math.BigDecimal
DECIMAL
NUMBER
 
 
 
String
CHAR
CHAR
String
VARCHAR
VARCHAR2
String
LONGVARCHAR
LONG
 
 
 
java.sql.Date
DATE
DATE
java.sql.Time
TIME
DATE
java.sql.Timestamp
TIMESTAMP
DATE
 
 
 
byte[]
BINARY
NUMBER
byte[]
VARBINARY
RAW
byte[]
LONGVARBINARY
LONGRAW
 
 
 
java.sql.Blob
BLOB
BLOB 
java.sql.Clob
CLOB
CLOB
 
 
 

Related Topics

Returning a Single Value from a Database Control Method

Returning a Single Row from a Database Control Method

Returning Multiple Rows from a Database Control Method

Parameter Substitution in @jws:sql Statements

Using an Existing Database Control