Chapter 11. Java and Oracle
The growth in Java usage and popularity has been a key development in the computing world in recent years. Java’s cross-platform capabilities and object-oriented functionality have given it broad acceptance as a development and runtime platform. Since the introduction of Oracle8i, Java has been an integral part of the overall Oracle environment.
There are two basic ways to access Oracle data from Java:
- SQLJ
A high-level language designed for embedding SQL statements into Java code. SQL statements used in SQLJ are checked at compile time. Up until Oracle9i, you could use SQLJ only for static SQL statements. With Oracle9i, you can now use SQLJ for both static and dynamic SQL statements.
- JDBC
A Java API that typically involves more coding than SQLJ. The SQL statements used in JDBC code are checked at runtime, so it is more loosely typed than SQLJ.
Both of these interfaces are established standards for Java, and each has its own virtues—fewer statements to code with SQLJ, more control with JDBC. To some extent, use of either interface is a matter of personal choice, although Java, with its low-level programming orientation, tends to appeal to developers who are not deterred by the more detailed coding required with JDBC. You can even mix JDBC calls with SQLJ in the same program if you wish.
This chapter focuses on using Java to interface with Oracle databases. It covers the following:
Java drivers available for Oracle
Using Java within the Oracle database
Mapping ...
Get Oracle in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.