Home arrow Oracle arrow Page 5 - Extending PL/SQL with Java Libraries, concluded

Mapping Oracle Types - Oracle

If you are looking for a way to extend stored programs with Java, look no further. This article, the second of two parts, is excerpted from chapter five of Expert Oracle PL/SQL, written by Ron Hardman and Michael McLaughlin (McGraw-Hill/Osborne, 2005; ISBN: 0072261943).

TABLE OF CONTENTS:
  1. Extending PL/SQL with Java Libraries, concluded
  2. Building Internal Server Java Objects
  3. More on Building Internal Server Java Objects
  4. Troubleshooting Java Class Library Build, Load, Drop, and Use
  5. Mapping Oracle Types
By: McGraw-Hill/Osborne
Rating: starstarstarstarstar / 12
January 19, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Oracle maps all native types and User Defined Types (UDTs) to Java types. When you use SQLData you map individual components and structures. The following table notes how Oracle types map to Java types:

SQL Data Types

Java Class Data Types

CHAR

oracle.sql.CHAR

LONG

java.lang.String

VARCHAR2

java.lang.Byte

 

java.lang.Short

 

java.lang.Integer

 

java.lang.Long

 

java.lang.Float

 

java.lang.Double

 

java.lang.BigDecimal

 

java.sql.Date

 

java.sql.Time

 

java.sql.Timestamp

 

byte

 

short

 

int

 

long

 

float

 

double

DATE

oracle.sql.DATE java.lang.String java.sql.Date java.sql.Time java.sql.Timestamp

NUMBER

oracle.sql.NUMBER java.lang.Byte java.lang.Short java.lang.Integer java.lang.Long java.lang.Float java.lang.Double java.lang.BigDecimal byte short

 

int

 

long float

 

double

OPAQUE

oracle.sql.OPAQUE

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.jdbc.Blob (JDK 1.1.x

CLOB NCLOB

oracle.sql.CLOB oracle.jdbc.Clob (JDK 1.1.x

OBJECT Object types

oracle.sql.STRUCT java.sql.Struct (JDK 1.1.x)

 

java.sql.SQLData

 

oracle.sql.ORAData

REF

oracle.sql.REF

Reference types

java.sql.Ref (JDK 1.1.x)

 

oracle.sql.ORAData

TABLE

oracle.sql.ARRAY

VARRAY

java.sql.Array (JDK 1.1.x)

Nested table and types

oracle.sql.ORAData

VARRAY types

 

Any of the preceding

oracle.sql.CustomDatum

SQL types

oracle.sql.Datum

Native types and UDTs can be used and managed by the SQLData conventions covered in the chapter. The Oracle JPublisher tool enables you to develop SQLData stubs and programs to use your UDTs.

Summary

You should now have an understanding of how to implement and troubleshoot server-side or internal Java class libraries. With these skills, you can build robust solutions in Java, affording you a certain simplicity over using PL/SQL.



 
 
>>> More Oracle Articles          >>> More By McGraw-Hill/Osborne
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

ORACLE ARTICLES

- Oracle Java Security Woes Continue
- Oracle's New IaaS Cloud Option: There's a Ca...
- Oracle Acquires Eloqua to Boost Cloud Presen...
- Choosing Innovation: Oracle Survey Insights
- Oracle Fixes Privilege Escalation Bug
- Oracle`s Communications Service Availability...
- Oracle Releases Exalytics, Taleo Plans
- Oracle Releases Communications Network Integ...
- Oracle Releases Communications Data Model 11...
- Oracle Releases PeopleSoft PeopleTools 8.52
- Oracle Integrates Cloudera Apache Distro, My...
- Oracle Releases MySQL 5.5.18
- Oracle Announces NoSQL Database Availability
- Sorting Database Columns With the SELECT Sta...
- Retrieving Table Data with the LIKE Operator

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: