Oracle8i SQLJ Developer's Guide and Reference Release 8.1.5 A64684-01 |
|
SQLJ profiles contain information about your embedded SQL operations, with a separate profile being created for each connection context class (or, equivalently, for each type of database schema) that your application uses. Profiles are created during the SQLJ translator's code generation phase and customized during the customization phase. Customization enables your application to use vendor-specific database features. Separating these vendor-specific operations into your profiles enables the rest of your generated code to remain generic.
Each profile contains a series of entries for the SQLJ statements that use the relevant connection context class, where each entry corresponds to one SQL operation in your application.
Profiles exist as serialized objects stored in resource files packaged with your application. Because of this, profiles can be loaded, read, and modified (added to or re-customized) at any time. When profiles are customized, information is only added, never removed. Multiple customizations can be made without losing preceding customizations, so that your application maintains the capability to run in multiple environments. This is known as binary portability.
For profiles to have binary portability, SQLJ industry-standard requirements have been met in the Oracle SQLJ implementation.
During code generation, the translator creates each profile as follows:
sqlj.runtime.profile.Profile
class.
.ser
file name extension.
Note:
Oracle SQLJ provides an option to have the translator automatically convert these |
As discussed in "Code Generation", profile file names for application Foo
are of the form:
Foo_SJProfilen.ser
SQLJ generates Foo_SJProfile0.ser
, Foo_SJProfile1.ser
, and so on as needed (depending on how many connection context classes are used). Or, if the -ser2class
option is enabled, then SQLJ generates Foo_SJProfile0.class
, Foo_SJProfile1.class
, and so on.
Each profile has a getConnectedProfile()
method that is called during SQLJ runtime. This method returns something equivalent to a JDBC Connection
object but with added functionality. This is further discussed in "Functionality of a Customized Profile at Runtime".
Below is a sample SQLJ executable statement with the profile entry that would result. For simplicity, the profile entry is presented as plain text with irrelevant portions omitted.
Note that in the profile entry, the host variable is replaced by JDBC syntax (the question mark).
Presume the following declaration:
#sql iterator Iter (double sal, String ename);
And presume the following executable statements:
String ename = 'Smith'; Iter it; ... #sql it = { select ENAME, SAL from EMP where ENAME = :ename };
================================================================= ... #sql { select ENAME, SAL from EMP where ENAME = ? }; ... PREPARED_STATEMENT executed via EXECUTE_QUERY role is QUERY descriptor is null contains one parameters 1. mode: IN, java type: java.lang.String (java.lang.String), sql type: VARCHAR, name: ename, ... result set type is NAMED_RESULT result set name is Iter contains 2 result columns 1. mode: OUT, java type: double (double), sql type: DOUBLE, name: sal, ... 2. mode: OUT, java type: java.lang.String (java.lang.String), sql type: VARCHAR, name: ename, ... =================================================================
Note:
This profile entry is presented here as text for convenience only; profiles are not actually in text format. They can be printed as text, however, using the SQLJ |