SQL/JRT
SQL/JRT, or SQL Routines and Types for the Java Programming Language, is an extension to the SQL standard first published as ISO/IEC 9075-13:2002 (part 13 of SQL:1999). SQL/JRT specifies the ability to invoke static Java methods as routines from within SQL applications, commonly referred to as "Java stored procedures". SQL/JRT also calls for the ability to use Java classes as SQL structured user-defined types. The two parts of the extension originate from the earlier ANSI SQLJ part 1 and 2 standards (not to be confused with SQLJ part 0, which defined an embedding of SQL into Java, later standardized by ISO as SQL/OLB.)
Example
SQL/JRT allows a Java function to be called from SQL code like this:
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.
Implementations
{{expand section|date=November 2012}}
SQL/JRT stored procedures are implemented in HSQLDB.[http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_jrt_routines HSQLDB manual] Java stored procedures have also been implemented in Oracle's JServer (or Aurora JVM), which was introduced in the Oracle Database version 8i in 1999;{{cite book|author=Bulusu Lakshman|title=Oracle & Java Development|url=https://books.google.com/books?id=MsEK0HJh2VAC&pg=PA6|year=2002|publisher=Sams Publishing|isbn=978-0-672-32117-7|page=6}}[http://docs.oracle.com/cd/F49540_01/DOC/java.815/a64686/01_intr4.htm The Aurora JVM and Its Components], Oracle Corp. it is now called Oracle JVM.{{cite book|author1=Rick Greenwald|author2=Robert Stackowiak|author3=Jonathan Stern|title=Oracle Essentials: Oracle Database 11g|url=https://archive.org/details/oracleessentials0000gree_n8w9|url-access=registration|year=2008|publisher=O'Reilly Media, Inc.|isbn=978-0-596-51454-9|page=[https://archive.org/details/oracleessentials0000gree_n8w9/page/323 323]}} IBM DB2 also supported Java stored procedures since about 1998, although using an external JVM (at that time).{{cite book|author1=Don Chamberlin|title=A Complete Guide to DB2 Universal Database|url=https://books.google.com/books?id=hb4zskzHrWYC&pg=PA565|accessdate=16 November 2012|year=1998|publisher=Morgan Kaufmann|isbn=978-1-55860-482-7|page=565}}
See also
References
External links
- [http://www.podgoretsky.com/ftp/docs/DB/SQL2003/5WD-13-JRT-2003-09.pdf SQL:2003 SQL/JRT draft]
- [http://farrago.sourceforge.net/design/UserDefinedTypesAndRoutines.html SQL:2003 SQL Standard User Defined Types and Routines] from the Farrago documentation
{{SQL}}
{{DEFAULTSORT:Sql Jrt}}
{{database-stub}}