Jump to content

SQL/JRT

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ysangkok (talk | contribs) at 13:19, 25 March 2012 (External links: add link). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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].

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