InfoQ Homepage News GraalVM inside Oracle Database

GraalVM inside Oracle Database


Oracle has added support for GraalVM-based stored procedures that run inside the database. The capability supports JavaScript functions through the Multilingual Engine (MLE) focused on the APEX framework.

This move expands the reach of GraalVM, which started as a Java Virtual Machine to compile applications as native executables and has since grown to support additional languages like Ruby and COBOL. Unlike common use cases of GraalVM that run on a development environment to produce native applications or run applications on a backend system, this usage operates directly inside Database 21c so that code operates in the same location where data is stored. The result is faster execution to analyze data as part of queries rather than needing to serialize and analyze data on the outside.

Alina Yurenko, developer advocate for GraalVM, summarizes the benefits of running code directly alongside the data:

This removes unnecessary data transfer over the network and can significantly improve performance of data-intensive operations, especially if applied to terabytes of data or more.

Second, storing and executing, for example, business rules inside the database guarantees that the rules are followed by every application, as well as users accessing the data, which can drastically simplify the implementation of security and compliance requirements.

Last, but not least, commonly-used functionality can be stored in a central place and executed as simple user-defined functions on top of ordinary SQL statements, avoiding the need to replicate the code in every application. This can be especially practical when the logic is more complex and/or tends to change frequently.

GraalVM replaces the older JavaScript implementation from previous Oracle databases that was provided by Nashorn and deprecated in Java 11. Kuassi Mensah, product management for Oracle DB, offers additional insight into what’s new in the 21c JDBC connector for Java developers. This includes capabilities like a pre-configuration for native GraalVM compilation (on applications outside the database), a reactive programming model, and support for virtual threads to improve performance. More thorough descriptions are available in Mensah's technology guide, "What's in Oracle Database 21c for Java Developers."

The Multilanguage Engine used by GraalVM in this context offers the opportunity for more developers to write stored procedures compared to the previous PL/SQL implementation. Where organizations like Lambda School, Code Academy, and others teach JavaScript as a common language, PL/SQL has become a much rarer skill set. JavaScript ranks as number 1 in RedMonk's top 20 language rankings and PL/SQL does not appear. A similar situation exists in StackOverflow's 2020 survey on most loved/dreaded/wanted technologies, where JavaScript ranks highly and PL/SQL does not even appear.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.