ISO IEC 19075-3:2021 pdf download – Information technology — Guidance for the use of database language SQL — Part 3: SQL embedded in programs using the Java programming language.
4.5 Profile customization overview — SQLJ.runtime.profile.RTStatement to execute SQL-statements. — SQLJ.runtime.profile.RTResultSet to describe query results. — SQLJ.runtime.profile.ConnectedProfile to create RTStatement objects corresponding to particular SQL-statements. An SQL-implementation is able to control SQL execution by providing an implementation of the RTStatement, RTResultSet, and ConnectedProfile interfaces. An SQL-implementation is able to redirect control to its own code by registering customization hooks with the application profiles. For example, if the client connects to SQL-server A, then a customization that understands SQL-server A’s system will be used. If the client connects to SQL-server B, then SQL-server B’s customization will be used. In the absence of a connection specific customization, the default JDBC based customization will be used. Like the profile object, customization objects are serializable. This allows the customization state to be stored and restored with the profile. In this manner, an implementation-dependent deployment tool is able to load the profile, inspect and precompile the SQL-statements it contains, register an appropriate customization, and store the profile in persistent storage. Then at application runtime, the profile and the registered implementation-dependent customization will both be restored, and the cus- tomization will be used to execute the SQL-statements. 4.5.2 Profile customization process The profile customization process is the act of registering profile customization objects with the profile(s) associated with an application. The profile customization process can be generalized to the following steps: 1) Discover the profile objects within a JAR file. 2) For each profile, deserialize the profile object from the appropriate JAR entry. 3) Create an SQL-connection with which the profile will be customized. 4) Create and register a profile customization with the profile. 5) Serialize the customized profile back to persistent storage. 6) Recreate the JAR contents using the customized serialized profiles. Of the above steps, only Step 4) is likely to change from SQL-implementation to SQL-implementation. While Step 3) is implementation-dependent, it can be done using a parameterized tool and JDBC. The rest of the steps involve actions that can be performed by any generic utility without specific knowledge of the customization being performed. The act of creating and registering a customization object with a profile (step 4 above) is abstractly defined by the Java interface SQLJ.runtime.profile.util.ProfileCustomizer. The intent of defining this interface is to allow SQL-implementations to concentrate on writing profile customizers and customization objects (step 4 above), while tools and application implementations concentrate on writing generic tools that apply customizers to application profiles (steps 1 – 3 and 5 – 6 above).