Oracle8/ SQLJ Programming



Similar documents
Oracle Database: SQL and PL/SQL Fundamentals

The Data Access Handbook

Oracle Database: SQL and PL/SQL Fundamentals NEW

Database Programming with PL/SQL: Learning Objectives

Oracle Database 10g: Program with PL/SQL

Developing Stored Procedures In Java TM. An Oracle Technical White Paper April 1999

Oracle 11g PL/SQL training

Oracle Backup & Recovery

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: Program with PL/SQL

ORACLE 9I / 10G / 11G / PL/SQL COURSE CONTENT

Oracle(PL/SQL) Training

Developing SQL and PL/SQL with JDeveloper

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL

Oracle Database: Develop PL/SQL Program Units

Duration Vendor Audience 5 Days Oracle Developers, Technical Consultants, Database Administrators and System Analysts

CS346: Database Programming.

Creating PL/SQL Blocks. Copyright 2007, Oracle. All rights reserved.

Oracle Database: Program with PL/SQL

Oracle Database 11g: Program with PL/SQL

PL/SQL Programming. Oracle Database 12c. Oracle Press ORACLG. Michael McLaughlin. Mc Graw Hill Education

PL/SQL Programming Workbook

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Enterprise Java. Where, How, When (and When Not) to Apply Java in Client/Server Business Environments. Jeffrey Savit Sean Wilcox Bhuvana Jayaraman

JAVA r VOLUME II-ADVANCED FEATURES. e^i v it;

Course -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement

Triggers & Packages. {INSERT [OR] UPDATE [OR] DELETE}: This specifies the DML operation.

Java Application Developer Certificate Program Competencies

Oracle PL/SQL Programming

Oracle Database: SQL and PL/SQL Fundamentals NEW

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:

What is ODBC? Database Connectivity ODBC, JDBC and SQLJ. ODBC Architecture. More on ODBC. JDBC vs ODBC. What is JDBC?

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

Oracle Database 11g: Advanced PL/SQL

CS 377 Database Systems SQL Programming. Li Xiong Department of Mathematics and Computer Science Emory University

Using SQL Developer. Copyright 2008, Oracle. All rights reserved.

Oracle 10g PL/SQL Training

Oracle SQL Developer for Database Developers. An Oracle White Paper June 2007

Oracle SQL Developer for Database Developers. An Oracle White Paper September 2008

SQL Server for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

AV-004: Administering and Programming with ORACLE

Database Web Services. An Oracle White Paper November 2002

Oracle For Beginners Page : 1

Java (12 Weeks) Introduction to Java Programming Language

Building Web Applications, Servlets, JSP and JDBC

Oracle JDeveloper 10g for Forms & PL/SQL

Application Development With Data Studio

Oracle to MySQL Migration

Demystified CONTENTS Acknowledgments xvii Introduction xix CHAPTER 1 Database Fundamentals CHAPTER 2 Exploring Relational Database Components

Self-test Database application programming with JDBC

LISTE DES DOCUMENTS ORACLE

Java SE 7 Programming

Java SE 7 Programming

Java SE 7 Programming

Elements of Advanced Java Programming

Fundamentals of Java Programming

Introduction to PL/SQL Programming

ORACLE DATABASE 11G: COMPLETE

SQL/PSM. Outline. Database Application Development Oracle PL/SQL. Why Stored Procedures? Stored Procedures PL/SQL. Embedded SQL Dynamic SQL

Oracle SQL. Course Summary. Duration. Objectives

OBJECT ORIENTED EXTENSIONS TO SQL

Chapter 13. Introduction to SQL Programming Techniques. Database Programming: Techniques and Issues. SQL Programming. Database applications

Instant SQL Programming

Database Migration from MySQL to RDM Server

Handling Exceptions. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total

<Insert Picture Here> Oracle SQL Developer 3.0: Overview and New Features

MCSE Windows 98 Study Guide

The Guru's Guide to Transact-SQL

Java SE 8 Programming

Performance Implications of Various Cursor Types in Microsoft SQL Server. By: Edward Whalen Performance Tuning Corporation

MySQL for Beginners Ed 3

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

PL/SQL Overview. Basic Structure and Syntax of PL/SQL

PL/SQL Developer 7.1 User s Guide. March 2007

The JAVA Way: JDBC and SQLJ

1 Changes in this release

Handling Exceptions. Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1

COSC344 Database Theory and Applications. Java and SQL. Lecture 12

Applets, RMI, JDBC Exam Review

Track and Keynote/Session Title 9:00:00 AM Keynote 11g Database Development Java Track Database Apex Track.Net Track. 09:30:00 AM with Oracle and

FileMaker 11. ODBC and JDBC Guide

AD-HOC QUERY BUILDER

Intro to Embedded SQL Programming for ILE RPG Developers

More SQL: Assertions, Views, and Programming Techniques

An Introduction to Object-Oriented Programming with

Specialized Programme on Web Application Development using Open Source Tools

Darshan Institute of Engineering & Technology PL_SQL

Database Programming. Week *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford

DBMS / Business Intelligence, SQL Server

Oracle Database. Products Available on the Oracle Database Examples Media. Oracle Database Examples. Examples Installation Guide 11g Release 2 (11.

Oracle Database. New Feature in Oracle Database 11g Release 2 ( ) Products Available on the Oracle Database Examples Media

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

Software Project Management (Second Edition)

Oracle Database 10g: Introduction to SQL

Transcription:

Technisch&AJniversitatDarmstadt Fachbeteich IpfcJrrnatik Fachgebiet PrjN^ische Informattk 7 '64283 Dar ORACLE Oracle Press Oracle8/ SQLJ Programming Tecbnischa UniversMt Osr FACHBEREICH INFORMATiK BIBLIOTHEK NirvaMorisseau-Leroy Martin K. Solomon Gerald P. Momplaisir Sachgebiate: SSandorr. «/ Osborne/McG raw-hill Berkeley New York St. Louis San Francisco Auckland Bogota Hamburg London Madrid Mexico City Milan Montreal New Delhi Panama City Paris Sao Paulo Singapore Sydney Tokyo Toronto Fachbereichsbibliothek Informatik _ TU_Darm stadt 5937241

v t5 on tents.- ' :^.. ' ' * 1 gword i. ; '..:......;-....%. X,' ;, ;' '.;...'., :.. X V if _ PART* ".. _ - (,i,,. Basic Oracle8i SQLJ» ' n Introduction to O,racle8i SQLJ...:..<"].'*'.*,~... ^. -,V - 3- Relation of the Java Language to Database Processing-on the Internet:.. 5.. Tight Ini^gration "pf Java and the/)racle8; Database Server ' 6 Static Embedded SQL Model for Java: SQLJ 11 :, Dynamic SQL-',." 1 Static;Embedded S Overview of SQLJ^^r. SQLJ Versus JLp#R. ^......Z...'.'.!/.'.[][][[[ 26 _. Deployment! of^fti*m Thick and Thin.Client-Side and /'. Server^We"Applicatioris -./.'.,.^f..' 28 /* ^jpritickplient Applications..' jt~, \ ;_. 28 "Thfii'Clieht Applications r, ' 29. Server-Side Applications.^ ;t)ther Embedded SQLs such as PL/SQL and Rr#C Versus' SOU ' * : X. ', - ' '... ". ^2

Oracle8/ SQLJ Programming 2 SQLJ Program Development 35 Executing Non-SELECT SQL Statements from a SQLJ Program 36 Connecting to a Database 37 SQLJ Executable Statements That Do Not Return Results 39 SQLJ Load Program: LoadAccountList.sqlj 40 Translating and Executing the LoadAccountList.sqlj Program... 45 Executing SELECT Statements from a SQLJ Program Using Named Iterators 46 Named Iterator Processing 47 A SQLJ Retrieval Program That Uses a Named Iterator: AcctsForProjs.sqlj 50 Executing SELECT Statements in SQLJ Programs Using Positional Iterators 55 Differences Between Named and Positional Iterators 55 A SQLJ Retrieval Program That Uses a Positional Iterator: AcctsForProjs2.sqlj 56 SQLJ Translation Process 61 SQLJ Command-Line Options and Properties Files 63 SQLJ Command-Line Options 63 Specifying SQLJ Options with Properties Files 66 3 Basic SQLJ Programming 71 Executable SQLJ Statements without Result Expressions: SQLJ DDL and Non-SELECT DML Commands 73 SQLJ DDL Commands 73 SQLJ DML Commands 74 Executable SQLJ Statements without Result Expressions: SQLJ Transaction Control Commands 83 auto-commit 84 SET TRANSACTION Statement 85 Executable SQLJ Statements without Result Expressions: Anonymous PL/SQL Blocks and Stored Procedure Calls 87 Anonymous PL/SQL Blocks 87 Stored Procedure Calls 88 Executable SQLJ Statements without Result Expressions: SET, FETCH, and SELECT INTO Statements 90 SET Statement 90 SELECT INTO Statement 91 FETCH Statement 92

Contents VN Executable SQLJ Statements with Result Expressions: SELECT Statements 92 Syntax of Iterator Declarations 93 Syntax of Query Clauses 97 A SQLJ Retrieval Program: AcctsForProjs3.sqlj 98 Populating Iterators with Nested Cursor Output 104 Support for ref cursor Types in SQLJ 112 Executable SQLJ Statements with Result Expressions: Stored Function Calls 116 Evaluation of Host Expressions and Result Expressions at Runtime 117 JDBC and SQLJ Exception Classes 117 Other Useful JDBC and SQLJ Classes 118 PART II Advanced SQLJ for Relational Processing 4 Developing SQLJ Stored Programs and Triggers 121 Development of SQLJ Stored Programs on the Client Side 122 Coding Considerations for Server-Side Applications 123 Emplnsert.sqlj: An Example of a Server-Side Application 125 Translating SQLJ Source Files on the Client Side 127 Loading Classes and Resources into the Server 127 Checking That Schema Objects Have Been Loaded in the Server.., 129 Creating a Top-Level SQL Wrapper for a Stored Subprogram... 130 FuncTest.sqlj: A Simple Application That Invokes a Stored Subprogram 134 Summary of Development Steps 136 Creating SQL Stored Subprogram Wrappers in PL/SQL Packages 137 The Invocation of SQLJ Stored Subprograms from SQL Statements and PL/SQL Blocks 143 Invocation of Stored Subprograms from PL/SQL Blocks 144 Invocation of Stored Functions from SQL DML Commands 144 Invocation of Stored Procedures Using the SQL CALL Statement 145 The Loading and Translation of SQLJ Source Files in the Oracle8; Server 153 Options Supported in the SQLJ Server Translator 154 Setting Options for the Server Translator 155 Generated Output from the Server Translator and loadjava 155 Error Output from the SQLJ Server Translator 155

Oracle8/ SQLJ Programming The dropjava Utility 156 Advantages and Disadvantages of Implementing Stored Subprograms in SQLJ Versus Implementing Them in PL/SQL 156 5 Advanced SQLJ Deployment 161 Using SQLJ Connection Context for Database Connections 162 Relation of the Execution Context to the Connection Context in the SQLJ Executable Statement 165 Using the SQLJ DefaultContext Class 167 Managing Multiple Database Connections with SQLJ 175 Deploying a SQLJ Application 187 Deploying a SQLJ Thick Client 187 Deploying SQLJ in an Application Server (Middle Tier) 188 Deploying a SQLJ Thin Client 188 Deploying SQLJ in a Java Application 190 Deploying SQLJ in a Java Applet 195 Deploying a SQLJ Applet 198 Deploying SQLJ in an Oracle8; Data Server: SQLJ Stored Procedure... 202 6 Advanced SQLJ Features 211 SQLJ Streams 212 Sending Data to the Database with Streams 213 Storing Files into the Database 214 Retrieving Data from the Database as Streams 218 Retrieving Stored Files from a Database 220 LOBs Large Objects 224 Loading Files into BLOB Columns 225 Retrieving Data from BLOB Columns and Writing It to Disk... 228 Using the DBMS_LOB Oracle Package with SQLJ 233 Using BFILE in SQLJ 234 Multi-threading 238 Multi-threading with SQLJ 238 Multi-threading with Execution Contexts 238 Multi-threading with SQLJ Application 239 Interoperability SQLJ and JDBC 243 Converting a JDBC Connection to a SQLJ Connection 244 Converting a SQLJ Connection to a JDBC Connection 247 Sharing and Closing Connections 247 SQLJ Iterator and JDBC Result Set Interoperability 249 Converting SQLJ Iterators to JDBC Result Sets 249 Casting JDBC Result Sets to SQLJ Iterators 250

Contents ix PART III SQLJ and Object Deployment 7 Object-Relational Processing Using SQLJ 257 Oracle8; User-Defined SQL Object Types 259 Creating Object Types and Object Tables 259 INSERT Statements for Object Tables 263 SELECT and UPDATE Statements for Object Tables 264 Processing SQL Object Types in SQLJ 265 Using JPublisher to Create Java Custom Classes for User-Defined Types 266 Java Custom Class Methods for Object Types and Referencing Types 269 ObjectTypes.sqlj: An Example SQLJ Program That Processes Tables Containing User-Defined SQL Object Types 270 SQLJ Stored Subprograms with SQL Object Type Parameters and Return Values 278 Oracle8/ User-Defined SQL Collection Types 281 Processing SQL Collection Types in SQLJ 286 CollectionTypes.sqlj: An Example SQLJ Program That Processes Tables Containing NESTED TABLEs and VARRAYs 288 8 SQLJ Business and Scientific Object Deployment 303 Basic Concepts of Distributed Computing Systems 304 Designing and Developing a SQLJ Component-Based Object 308 What Is a Component? 308 What Is a Component Model? 309 Developing a SQLJ Component 311 Deploying a SQLJ Component Using the Java Remote Method Invocation 327 What Is RMI? 328 RMI Object Composites 329 Developing an RMI Object 330 Deploying an Enterprise JavaBeans Object Using a SQLJ Implementation 343 What Is Enterprise JavaBeans? 344 Enterprise JavaBeans Roles 344 Types of Enterprise JavaBeans 346 Enterprise JavaBeans Object Composites 346 Developing an Enterprise Session Bean Application 348 Deploying a CORBA Object Using a SQLJ Implementation 365 What Is CORBA? 365 CORBA Object Composites 368 Developing a CORBA Object 369

X Oracle8/ SQLJ Programming PART IV Effective Use of SQLJ 9 SQLJ Applications: Performance Tuning 387 Extending the ConnectionManager Class 388 Developing Efficient SQLJ Programs 393 Performance Enhancements 394 Row Prefetching with SQLJ 395 Tuning SQLJ Statements with the Oracle Optimizer 402 Consider Other Ways to Reduce Network Traffic 403 10 Survey of Oracle8/ Development Tools 407 Brief Overview of Oracle Internet Development Tools 408 Oracle Designer Tool 408 Oracle WebDB 409 Oracle JDeveloper 410 Developing a SQLJ Application Using JDeveloper 412 1. Creating a New Workspace 412 2. Creating a New Project 413 3. Adding a SQLJ Source File to the Project 417 4. Setting the Project Properties 419 5. Compiling a SQLJ Program 421 6. Running a SQLJ Program 423 PART V Appendices A Basic Oracle SQL 431 The Relational Model for Databases 432 SQL 436 SQL DDL Commands 436 SQL DML Commands 437 SELECT Statements 438 INSERT SELECT, DELETE, and UPDATE Statements 444 Transaction Control Commands 445 Embedded SQL 445 Embedded SQL Example Program 446 Cursors 448 PL/SQL 450 PL/SQL Block 451 PL/SQL Subprograms 454 PL/SQL Packages and Exceptions 456

Contents xi B Java Basics 463 The Java Application 464 Variables and Data Types 465 Arrays and Strings 466 Operators 466 Expressions 466 Control Flow Statements 466 Compilation and Execution 467 Java Classes and Objects 467 Creating and Using Objects 468 Creating and Using Constructors 470 Using this 471 Class Members 472 Access Modifiers 474 Method Return Types 475 Creating Subclasses 475 Creating Packages 476 Importing Classes and Packages 477 Abstract Classes 477 Interfaces 478 Introduction to Java Applets 479 Brief Overview of the Java AWT Class 484 C Introduction to Java Database Connectivity (JDBC) 491 Creating a JDBC Application 492 1. Import the JDBC Package 494 2. Load and Register the JDBC Driver 494 3. Create the Connection Object to Connect to the Database... 495 4. Create the Statement Instance to Perform Database Tasks... 495 5. Use the Statement Instance to Execute Database Tasks 495 6. Use the JDBC ResultSet Object 496 7. Close the Statement Instances and the ResultSet 496 8. Close the Connection to the Database 496 Java Applet Calls a PL/SQL Stored Procedure 497 D SQLJ Quick Reference Guide 501 Setting the SQLJ Environment 502 Setting the CLASSPATH and PATH Environment Variables 503 SQLJ Declarations 505 Iterator Declaration 505 Connection Context Declaration 505 implements Clause 505 with Clause 506

Oracle8/ SQLJ Programming Java Host Expressions 506 Executable Statement Clause 507 The SQL Clause 507 The SELECT INTO Clause 507 The FETCH INTO Clause 508 The COMMIT and ROLLBACK Clauses 508 The Procedure Clause 509 The Function Clause 509 The Assignment Clause (SET) 509 PL/SQL Blocks 510 Database Connections 510 The DefaultContext Class 511 The ConnectionContext Class 512 The ExecutionContext Class 513 Connection Properties File 514 Selected sqlj.runtime Classes 514 The sqlj.runtime.ref.defaultcontext Class 514 The sqlj.runtime.executioncontext Class 515 Supported Types for Host Expressions 517 Standard JDBC Types 517 Java Wrapper Classes 518 Oracle Extensions 518 SQLJ Stream Classes 519 Tools 520 SQLJ Translator Tool: sqlj 520 Java Archive Tool: jar 522 JPublisher Tool: jpub 523 Load Java Tool: loadjava 525 Drop Java Tool: dropjava 527 Enterprise JavaBeans Tool: deployejb 528 Session Namespace Tool: publish 530 Bibliography 533 Index 539