Home > Articles > Data > Oracle

  • Print
  • + Share This
From the author of

Oracle Facilities Common to PL/SQL and Java

In Oracle8i and above, PL/SQL and Java share a number of common facilities:

  • Library management. The basic storage unit for packages, procedures, tables, and so on in Oracle databases is a library unit. PL/SQL and Java objects can be stored and retrieved as library units. Both languages provide library unit management facilities so that the appropriate procedures and classes can be loaded at runtime. In addition, the library unit management facilities manage information related to inter-unit dependency and automatically recompile dependent binaries when the source is modified. When Java files are loaded into the Oracle database as schema objects using the LoadJava utility, the object name is derived from the fully qualified name of the class, including the package name. The following types of Java files can be loaded as library units:

    • Java source files
    • Java class files
    • Java resource files
    • SQLJ input files
    • Uncompressed Java archives (JAR) or ZIP files

  • Security model. A common security model is used by PL/SQL and Java. Both privilege modes, namely definer and invoker rights, are supported. User authentication can be performed using either the standard database username/password mechanism or SSL certificate. When communicating with either PL/SQL or Java programs, the communication between client and server can be encrypted using SSL x.509v3 certificates.

  • SQL access. Both PL/SQL and SQLJ provide compile-time checking of SQL statements. The following items are checked:

    • SQL syntax
    • Type compatibility of host variables
    • Correctness of the query in reference to the definition of Oracle objects

    Dynamic SQL statements supported by PL/SQL and JDBC include the following:

    • SQL statements
    • Anonymous PL/SQL blocks
    • Data Definition Language statements
    • Transaction Control statements

SQLJ doesn't support dynamic SQL directly, but it can be used to make JDBC calls for dynamic SQL.

A number of PL/SQL packages—such as DBMS_DDL, DBMS_MAIL, DBMS_OUTPUT, and UTL_FILE—have equivalent Java implementations, but not all packages have this equivalency. It should be noted that when an equivalent Java implementation doesn't exist for a PL/SQL package, you can generally call the PL/SQL package using JDBC or SQLJ.

  • + Share This
  • 🔖 Save To Your Account