GraalVM demos: Oracle Database Multilingual Engine (MLE) based on JavaScript module

This repository contains the instructions how to run the Oracle Database Multilingual Engine (MLE),based on JavaScript module, with functions stored as procedures in the database.

Prerequisites

Preparation

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

Load the docker image:

  1. 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):

  1. docker run mle-docker-0.2.7

Shell into the docker container:

  1. docker exec -ti <container_id> bash -li

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

  1. docker ps

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

  1. 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 onthe 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 validatormodule from NPM, install the TypeScript types for the validator module.

  1. mkdir crazyawesome
  2. cd crazyawesome
  3. echo "{}" > package.json
  4. npm install validator
  5. npm install @types/validator

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

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

Start sqlplus again:

  1. sqlplus scott/tiger@localhost:1521/ORCLCDB

Use the validator module functions as the stored procedures. Make sure to put a semicolon after the query:

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