Using the Embedded Java API

Embedded Java is disabled by default. When disabled, creation or execution of Embedded Java will report an error. To enable Java stored procedures and Java UDFs, set the embedded-java database option to enable when using nuocmd start process.

SECURITY ALERT! Enabling Embedded Java may cause security vulnerabilities due to unrestricted access to system resources.

In addition to SQL, NuoDB supports Java stored procedures, triggers, and user defined functions (UDF). The Java API supported by stored procedures, triggers, and user defined functions is referred to as the NuoDB embedded Java API and it is important to note differences between the NuoDB JDBC Driver API and the NuoDB embedded Java API. See Unsupported Methods in Embedded Java API for more information.

When the Transaction Engine (TE) invokes a Java stored procedure, trigger, or UDF, it will use the same JVM that was used to invoke the broker that started the TE.

However, if the TE has been invoked manually (that is, not via the broker), the method for finding the JVM is platform specific.

  • On Linux, the TE will look for the JVM pointed to by the JAVA_HOME environment variable. If the JAVA_HOME environment variable is not set, it will look in well known locations, e.g. /usr/lib/java/…​

  • On Windows, the TE will look for the default JVM in the registry (HKLM\SOFTWARE\JavaSoft\Java Runtime Environment)