GraalVM demos: Multi language engine based on JavaScript module

This repository contains the instructions how to run multi language engine, based on JavaScript module, with functions stored as procedures in the database.

Prerequisites

Preparation

Download the docker container of the Oracle database with an experimental support for the Multi Language Engine from Oracle Database MLE.

Load the docker image:

docker load --input mle-docker-0.2.7.tar.gz

Run the container (note that you can also configure non-default credentials, but this tutorial does not do that):

docker run mle-docker-0.2.7

Shell into the docker container:

docker exec -ti <container_id> bash -li

To show only running containers and find out a necessary container ID, use the given command:

docker ps

You have to wait for the database to start. It may take quite a lot of time for the first run, next runs are faster. To verify the database has started, run the sqlplus from a new command shell:

sqlplus scott/tiger@localhost:1521/ORCLCDB

Note: scott/tiger are the default login/password. ORCLCDB is a site identifier (SID). There can be more than one database on the same Oracle_HOME, that is why SID is required to identify them. If you have changed the default login/password, change the command respectively. If sqlplus works - the database is ready. Exit sqlplus.

Create a directory, initialize an empty node package, install the validator module from NPM, install the TypeScript types for the validator module.

mkdir crazyawesome
cd crazyawesome
echo "{}" > package.json
npm install validator
npm install @types/validator

Deploy the validator module to the database, in the following command validator is the module name:

dbjs deploy -u scott -p tiger -c localhost:1521/ORCLCDB validator

Start sqlplus again:

sqlplus scott/tiger@localhost:1521/ORCLCDB

Use the validator module functions as the stored procedures:

select validator.isEmail('oleg.selaev@oracle.com') from dual
select validator.isEmail('oleg.selaev') from dual