Skip to Main Content
Oracle PL/SQL Language Pocket Reference, 4th Edition
book

Oracle PL/SQL Language Pocket Reference, 4th Edition

by Steven Feuerstein, Bill Pribyl, Chip Dawes
October 2007
Intermediate to advanced content levelIntermediate to advanced
178 pages
2h 50m
English
O'Reilly Media, Inc.
Content preview from Oracle PL/SQL Language Pocket Reference, 4th Edition

Java Language Integration

Java programmers can write server-side classes that invoke SQL and PL/SQL using standard JDBC or SQLJ calls. PL/SQL programmers can call server-side Java methods by writing a PL/SQL cover or call spec for Java using Oracle database DDL.

Server-side Java in the database may be faster than PL/SQL for computer-intensive programs, but not as nimble for database access. PL/SQL is much more efficient for database-intensive routines because, unlike Java, it doesn’t have to pay the overhead for converting SQL datatypes for use inside the stored program. Database programmers will want to continue to use PL/SQL for programs that perform a lot of database I/O and use Java for the best raw computation performance. Follow these steps to create a Java stored procedure ( JSP):

  1. Write or otherwise obtain functional Java code. Having source code is not necessary, though, so you can use class libraries from third parties. The classes must, however, meet two requirements. Methods published to SQL and PL/SQL must be declared static; PL/SQL has no mechanism for instantiating nonstatic Java classes. In addition, the classes must not issue any GUI calls (for example, to AWT) at runtime.

    If you write your own JSP and it needs to connect to the database for access to tables or stored procedures, use standard JDBC and/or SQLJ calls in your code. Many JDBC and SQLJ reference materials are available to provide assistance in calling SQL or PL/SQL from Java, but be sure to review the product-specific ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle PL/SQL Language Pocket Reference, 5th Edition

Oracle PL/SQL Language Pocket Reference, 5th Edition

Steven Feuerstein, Bill Pribyl, Chip Dawes

Publisher Resources

ISBN: 9780596514044Errata Page