SQL/JRT
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, commonly referred to as "Java stored procedures". 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 JVM) was introduced in the Oracle Database version 8i in 1999.[2][3] It is now called Oracle JVM.[4]
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
- ^ Bulusu Lakshman (2002). Oracle & Java Development. Sams Publishing. p. 6. ISBN 978-0-672-32117-7.
- ^ The Aurora JVM and Its Components, Oracle Corp.
- ^ Rick Greenwald; Robert Stackowiak; Jonathan Stern (2008). Oracle Essentials: Oracle Database 11g. O'Reilly Media, Inc. p. 323. ISBN 978-0-596-51454-9.
External links
- SQL:2003 SQL/JRT draft
- SQL:2003 SQL Standard User Defined Types and Routines from the Farrago documentation