ArticleslgStudy

science

SQL/JRT

SQL/JRT is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand SQL/JRT rather than just read about it. In short: 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".

Key takeaways

  • SQL/JRT belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect SQL/JRT to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of SQL/JRT from memory before moving on to harder problems.

Reference excerpt

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:

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 HSQLDB implements SQL/JRT functions and procedures alongside routines written in SQL/PSM. A Java routine names a public static Java method in its EXTERNAL NAME clause; SQL arguments and return values are converted to the corresponding Java types. Functions can return scalar values or tables represented by java.sql.ResultSet objects. The database stores the routine definition in its script, while the referenced Java class must be available to the database's class loader. HSQLDB applies the same routine characteristics to SQL/JRT and SQL/PSM routines, including declarations describing whether a routine is deterministic and whether it reads or modifies SQL data. These declarations allow the database to validate where the routine may be used and to optimize calls whose results are repeatable. Java stored procedures were also implemented in Oracle's JServer (originally called the Aurora JVM), introduced with Oracle Database 8i in 1999; it later became known as the Oracle JVM. IBM Db2 supported Java stored procedures by 1998 using an external JVM.

See also SQL:2003

References

External links SQL:2003 SQL/JRT draft SQL:2003 SQL Standard User Defined Types and Routines from the Farrago documentation

Worked examples

Example 1 — a first encounter with SQL/JRT

Start with the simplest possible case. Write down what SQL/JRT claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to SQL/JRT before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about SQL/JRT ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of SQL/JRT

In research
SQL/JRT appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses SQL/JRT in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
SQL/JRT is common in secondary-school and first-year university syllabi. It links to neighbouring topics Database stubs, SQL, so understanding it makes those chapters shorter.
In everyday life
Look for SQL/JRT outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “SQL/JRT” →

How to study SQL/JRT in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what SQL/JRT means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain SQL/JRT out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is SQL/JRT in simple terms?

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 "Jav…

Why does SQL/JRT matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study SQL/JRT?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on SQL/JRT.

Tags

  • Database stubs
  • SQL

Keep exploring