oracle_javascript
oracle_javascript
Databases with
code written in
JavaScript
(Oracle vs MySQL
& SQL Server)
Advanced Database
Assignment A
Group: Huda Ibrahim & Denis Muriuki
1
Server-Side Programming
Oracle External Procedures
Oracle Multilingual Engine (MLE) with JavaScript
Oracle (MLE) Advantages & Disadvantages
Creating MLE Module
3
Oracle External Procedures
1- Write the External Procedure.
External procedures are functions developed in
third-generation languages (e.g., C) that can be
invoked from PL/SQL or SQL, behaving like native 2- Build the DLL using a C compiler and linker.
PL/SQL routines.
3- Register the Procedure in the database.
4
External Procedures
Advantages Disadvantages
• Performance: Certain tasks execute more • Security Warning: Never set ENVS =
efficiently in third-generation languages "EXTPROC_DLLS = ANY" in listener.ora, as it
compared to PL/SQL, which is optimized for disables DLL verification, allowing attackers to
execute any DLL. This poses a significant security
SQL transaction processing.
risk, even if the Listener is configured for low-
• Code Reusability: Dynamic link libraries privileged users
(DLLs) can be directly invoked from PL/SQL, • C compiler and linker are required to build DLLs.
enhancing modularity and reuse across
server and client tools • Steps of Creating & Registering Dlls.
5
Oracle Multilingual
Engine (MLE) with
JavaScript
•The DBMS_MLE package allows users to
execute JavaScript code inside the Oracle
Database and exchange data seamlessly
between PL/SQL and JavaScript.
6
Oracle (MLE) Advantages & Disadvantages
Advantages Disadvantages
• The logic gets executed where the data resides. • The strongest privileges in MLE let super-users
create, alter, and drop MLE schema objects in any
• Storing and running business rules in the database
schema, not just their own. Like all privileges in
ensures that all applications and users follow
security and compliance needs. Oracle Database, those with "ANY" in their name
are the most powerful and should only be given to
• Developers can keep application logic and data trusted users if needed
together, which improves data quality
7
Creating MLE Module
Environment Setup
• Grants
• Parameters
• Procedures
• Functions
8
Demo (Using MLE
Module and
JavaScript in
Oracle)
Scenario #1
9
ChatGPT Query
PLS-00103: string
Cause: This error message is from the
parser. It found a token (language Question
element) that is inappropriate in this
context.
Action: Check previous tokens as well
as the one given in the error message.
The line and column numbers given in
Answer
the error message refer to the end of
the faulty language construct.
10
MySQL MLE Feature
MySQL introduced the Multilingual Engine
(MLE) feature, it is included in MySQL
Enterprise Edition 9.0, with this feature you
can make and run MySQL programs using
JavaScript language.
11
Demo of
MySQL MLE
Feature
Scenario #2
Creating MLE
function to increase
employee salary by
10%
12
SQL SERVER
External Procedures External procedures in SQL Server can be
handled using the common language
runtime which is integrated within the
database itself. One can write and run
stored procedures written in .NET
languages such as C# and VB.NET.
13
Demo of SQL Server using External Procedures
• Creating External
procedure on
Microsoft
SQLServer and
Visual Studio 2022
using C# and SQL.
14
Thank you
15