SQL/JRT
Appearance
The SQL/JRT, or SQL Routines and Types for the Java Programming Language, extension to the SQL standard is defined by ISO/IEC 9075-13:2003. SQL/JRT specifies the ability to invoke static Java methods as routines from within SQL applications. It also calls for the ability to use Java classes as SQL structured user-defined types.
SQL/JRT is implemented in HSQLDB[1]. A similar feature called JServer or "Aurora" exists in the Oracle Database.
Example
SQL/JRT allows a Java function to be called from SQL code like this[1]:
CREATE FUNCTION sinh(v DOUBLE) RETURNS DOUBLE
LANGUAGE JAVA DETERMINISTIC NO SQL
EXTERNAL NAME 'CLASSPATH:java.lang.Math.sinh'
SELECT sinh(doublecolumn) FROM mytable
SQL/JRT also allows Java code to dynamically generate tables using a java.sql.ResultSet
object. The result sets returned are converted to SQL tables and can be used anywhere a table or view can be used[1].
See also
References
- ^ a b c HSQLDB manual
External links
- SQL:2003 SQL/JRT draft
- SQL:2003 SQL Standard User Defined Types and Routines from the Farrago documentation