O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Java Programming with Oracle SQLJ

Book Description

If you're a Java programmer working in an Oracle environment, you're probably familiar with JDBC as a means of accessing data within an Oracle database. SQLJ takes you further, allowing you to access a database using embedded SQL statements. Java Programming with Oracle SQLJ shows you how to get the most out of SQLJ. Layered on top of JDBC, SQLJ greatly simplifies database programming. Rather than make several calls to the JDBC API just to execute a simple SQL statement, SQLJ executes that statement simply by embedding it within the Java code. In this book, Jason Price explains SQLJ programming from a task-oriented point of view. You'll learn how to:

  • Embed queries and other SQL statements within Java programs

  • Deploy SQLJ code not only on client machines, but also to JServer--Oracle's Java engine built into the database

  • Use advanced techniques for working with collections, streams, large objects, and database objects, all without leaving the comfort of the SQLJ environment

  • Tune SQLJ programs for maximum performance

Throughout the book, the exposition of SQLJ and SQLJ programming techniques reflects the author's many years of professional experience as a programmer and consultant. Examples are first-rate, enabling you to learn SQLJ in no time. If you're writing Java code to access an Oracle database, you can't afford not to know about SQLJ.

Table of Contents

  1. Copyright
  2. Preface
    1. Audience
    2. Organization
    3. About the Examples
    4. Software and Versions
    5. Conventions Used in This Book
    6. Comments and Questions
    7. Acknowledgments
  3. Introduction
    1. Comparing SQLJ and JDBC
    2. SQLJ Components
    3. Requirements for Using SQLJ
    4. Configuring Your Environment
    5. A "Hello World" Program for SQLJ
    6. The sqlj Command-Line Utility
    7. Oracle JDeveloper
  4. Relational Databases, SQL, and PL/SQL
    1. Relational Databases
    2. Structured Query Language (SQL)
    3. PL/SQL
  5. Fundamental SQLJ Programming
    1. SQLJ Programs
    2. Database Connections
    3. Simple SQLJ Statements
    4. Transactions
    5. Queries That Return Multiple Rows
    6. Nested Cursors
    7. PL/SQL in SQLJ
  6. Database Objects
    1. Defining Object Types
    2. Object Columns and Object Tables
    3. Creating Custom Classes
    4. Accessing Database Objects Using SQLJ
    5. Object Identifiers and REF Columns
  7. Collections
    1. VARRAYs
    2. Nested Tables
    3. Storing an Object Type in a Collection
    4. Collection Custom Classes
    5. Accessing Collections Using SQLJ
  8. Deploying SQLJ in the JServer
    1. Understanding the Oracle JServer
    2. Designing Server-Based SQLJ Programs
    3. Translating SQLJ Programs
    4. Loading SQLJ Programs into the Database
    5. Publishing Class Methods
    6. Using Database Triggers
    7. Using JDeveloper to Translate and Load SQLJ Programs
    8. Using Enterprise JavaBeans
  9. Large Objects
    1. The Example Files and Directories
    2. Large Objects (LOBs)
    3. LONG and LONG RAW Columns
  10. Contexts and Multithreading
    1. Connection Contexts
    2. Execution Contexts
    3. Multithreaded SQLJ Programs
  11. Advanced Transaction Control
    1. Transaction Processing Problems
    2. Transaction Isolation Levels
    3. The SET TRANSACTION Statement
    4. A Transaction Isolation Level Example
  12. Performance Tuning
    1. Row Prefetching
    2. Batch Processing
    3. Tuning SQL Statements
    4. The Oracle Optimizer
  13. Combining JDBC, SQLJ, and Dynamic SQL
    1. Static and Dynamic SQL
    2. Sharing Database Connections
    3. SQLJ Iterators and JDBC Result Sets
  14. Java and Oracle Type Mappings
    1. JDBC 1.x Type Mappings
    2. Additional JDBC 2.0 Type Mappings
    3. Java Wrapper Class Mappings
    4. SQLJ Stream Class Mappings
    5. Oracle Extension Class Mappings
  15. Oracle Java Utilities Reference
    1. Oracle SQLJ Translator
    2. JPublisher
    3. loadjava
    4. dropjava
    5. deployejb
  16. SQLJ in Applets, Servlets, and JavaServer Pages
    1. SQLJ in Applets
    2. SQLJ in Servlets
    3. SQLJ in JavaServer Pages
  17. Colophon
  18. Index