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:
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 forthe 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 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.
mkdir crazyawesome
cd crazyawesome
echo "{}" > package.json
npm install validator
npm install @types/validator
Deploy the validator module to the database, in the following commandvalidator
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. Make sure to put a semicolon after the query:
select validator.isEmail('oleg.selaev@oracle.com') from dual;
select validator.isEmail('oleg.selaev') from dual;