BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News GraalVM inside Oracle Database

GraalVM inside Oracle Database

This item in japanese

Lire ce contenu en français

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

Adoption
Style

BT