Oracle8i SQLJ Developer's Guide and Reference Release 8.1.5 A64684-01 |
|
This section provides information about the Oracle SQLJ runtime, which is a thin layer of pure Java code that runs above the JDBC driver. When Oracle SQLJ translates your SQLJ source code, embedded SQL commands in your Java application are replaced by calls to the SQLJ runtime. Runtime classes act as wrappers for equivalent JDBC classes, providing special SQLJ functionality. When the end-user runs the application, the SQLJ runtime acts as an intermediary, reading information about your SQL operations from your profile and passing instructions along to the JDBC driver.
The Oracle SQLJ runtime consists of the packages listed below. There are classes you can import and use directly in your application (primarily in sqlj.runtime
), but most of the runtime classes are for internal use by SQLJ. Packages whose names begin with oracle
are for Oracle-specific SQLJ features.
sqlj.runtime
This package is the most likely to be imported and used directly in your application. It contains wrapper classes for various kinds of input streams (binary, ASCII, and Unicode), as well as interfaces and abstract classes that are implemented by Oracle SQLJ connection contexts and iterators.
The interfaces and abstract classes in this package are implemented by classes in the sqlj.runtime.ref
package or by classes generated by the SQLJ translator.
sqlj.runtime.ref
The classes in this package implement interfaces and abstract classes in the sqlj.runtime
package. You will almost certainly use the sqlj.runtime.ref.DefaultContext
class, which is used to specify your default connection and create default connection context instances. The other classes in this package are used internally by SQLJ in defining classes during code generation, such as iterator classes and connection context classes that you declare in your SQLJ code.
sqlj.runtime.profile
This package contains interfaces and abstract classes that define what SQLJ profiles look like. This includes the EntryInfo
class and TypeInfo
class. Each entry in a profile is described by an EntryInfo
object (where a profile entry corresponds to a SQL operation in your application). Each parameter in a profile entry is described by a TypeInfo
object.
The interfaces and classes in this package are implemented by classes in the sqlj.runtime.profile.ref
package.
sqlj.runtime.profile.ref
This package contains classes that implement the interfaces and abstract classes of the sqlj.runtime.profile
package and are used internally by the SQLJ translator in defining profiles. It also provides the default JDBC-based runtime implementation.
sqlj.runtime.profile.util
This package contains utility classes used to access and manipulate profiles. For example, SQLJ uses the CustomizerHarness
class in this package to invoke a specified profile customizer on a specified set of profiles, according to the SQLJ option settings you specify when you translate your SQLJ source code.
sqlj.runtime.error
This package, used internally by SQLJ, contains resource files for all generic (non-Oracle-specific) error messages that can be generated by the SQLJ translator.
oracle.sqlj.runtime
This package contains Oracle-specific runtime classes used by the Oracle implementation of SQLJ. For example, this package includes functionality to convert to and from Oracle type extensions. It also includes the Oracle
class that you can use to instantiate the DefaultContext
class and establish your default connection.
oracle.sqlj.runtime.util
This package contains utility classes used by SQLJ to access and manipulate Oracle-specific profiles, including the OraCustomizer
class for customizing profiles.
oracle.sqlj.runtime.error
This package, used internally by SQLJ, contains resource files for all Oracle-specific error messages that can be generated by the SQLJ translator.
Runtime errors may be generated by any of the following:
In any of these cases, a SQL exception is generated as an instance of the java.sql.SQLException
class or a subclass (such as sqlj.runtime.SQLNullException)
.
Depending on where the error came from, there may be meaningful information that you can retrieve from an exception using the getSQLState()
, getErrorCode()
, and getMessage()
methods. SQLJ errors, for example, include meaningful SQL state and message. For information, see "Retrieving SQL States and Error Codes".
If errors are generated by the Oracle JDBC driver or RDBMS at runtime, look at the prefix and consult the appropriate documentation:
For a list of SQLJ runtime errors, see "Runtime Messages".