Function of Java External Procedures - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
jbg1472252759029
lifecycle
latest
Product Category
Teradata Vantage™

When you write the code for an external procedure definition, you indicate that its language is Java by specifying LANGUAGE JAVA in the mandatory LANGUAGE clause (see LANGUAGE Clause).

Java external procedures execute SQL code using the standard JDBC driver interface. Because the Java external procedure is running on the database and is invoked from within a logged on session, its connection to the database is by means of a default connection named jdbc:default:connection.

Note that a Java program can create a separate connection to another database, or to the same database (by means of another session to be logged onto). If an external Java procedure does this, its actions can create an undetectable deadlock.

The ANSI SQL:2011 standard specifies the following set of rules for a Java external procedure.
  • You must compile the Java source code outside the database.

    The external Java language routine must be written using the JDBC standard for coding embedded SQL statements in a Java program.

    The resulting class or classes (the byte code) must be placed in a JAR file.

  • You must then register the JAR file with the database.
  • To do this, you call an external procedure named SQLJ.Install_Jar.
  • The system creates the Java external procedure using its EXTERNAL NAME clause, which specifies the registered JAR file and its associated Java class.

Once it has been created, you can access the Java routine in the same manner as any external procedure.

See Teradata Vantage™ - SQL External Routine Programming, B035-1147 for information on writing Java external procedures.