Overview
ISO/IEC 19075-3:2021 provides guidance for embedding the SQL database language inside programs written in the Java programming language. The standard explains how to integrate SQL expressions and statements into Java source, describes design goals (such as binary portability and compile-time checking), and documents runtime profile customization and utilities that enable database-specific behavior. This is commonly referred to when implementing or using SQL embedded in Java (SQL/OLB / SQLJ) solutions and when deciding between embedded SQL and lower-level APIs like JDBC.
Key topics and technical requirements
- Embedding SQL in Java: Rules and recommendations for placing SQL expressions and statements directly in Java code, including host expressions and host variables.
- Design goals: Support for compile-time SQL syntactic/semantic checking, location-independent SQL semantics, binary portability, and shared SQL connection usage between SQL/OLB and JDBC environments.
- Advantages over JDBC: Smaller, higher-level source programs; potential for translator compile-time type checking; direct embedding of Java host expressions; stronger typing and simplified SQL-invoked routine invocation.
- Profile customization: Mechanisms to add implementation-specific SQL execution control via serializable profile customizers and runtime interfaces (for example, SQLJ.runtime.profile.RTStatement, RTResultSet, ConnectedProfile).
- Profile customization process: Steps for discovering, deserializing, customizing, and reserializing profiles (JAR-based profiles), enabling SQL implementations to register hooks for particular DBMS behavior.
- Runtime and utilities: Recommendations for tools (CLI, GUI/IDE integrations, installers) to automate profile customization and precompile/optimize embedded SQL.
- Examples and features: Iterators, binding strategies (positional and named), connection contexts, batching, result mapping, user-defined types, and techniques to obtain java.sql.ResultSet objects from SQL/OLB iterators.
Applications and users
Who uses ISO/IEC 19075-3:
- Java application developers who want to embed SQL directly in their code for stronger typing and simpler source.