Skip to Main Content

APEX

Office Hours - APEX 23.1 and server-side JavaScript: Explore the power of GraalVM/MLE

Mónica Godoy -OracleJun 26 2023 — edited Jun 27 2023

Thanks for joining us in the past Office Hour session: APEX 23.1 and server-side JavaScript: Explore the power of GraalVM/MLE
Watch the replay of the session: apex.oracle.com/officehours and find below the Q&A for the live session.

  • Is the commit for the records updated or extended automatically done?
    Auto-commit is implied, just like with regular PL/SQL processes, as long as there's no error To add up on this, you can use session.execute() and session.rollback() to have explicit control (just as in COMMIT/ROLLBACK in PL/SQL).
  • Can JS static Files in the APEX app be called in the "Excecute Code" editor, so we can centralized the JS code in one place?
    Not exactly. app static files are meant rather for being served to the front-end. for source code, using real MLE modules is the way. they do have to be treated just like any other database object though. I think Salim will get to that now.
  • Is it possible to pass CLOBs and BLOBs to MLE without problems, process an image, and return it to PLSQL? Or are there limitations on parameter size?
    Passing CLOBs, BLOBs, json, whatever, works just fine. The bigger issue is whether these libraries that manipulate images will run on MLE. Remember, we're not in a browser. Some browser things, like Canvas, that many of these libraries use, exist in the browser, but not in MLE. Think of MLE more like Node.js. If you can find a library (I know of Jimp) that does not employ Convas, things should work fine.
  • For example, when passing an image to MLE javascript, should it be base64 encoded etc, or can be passed as BLOB?
    BLOB I believe works too. We're looking to have a Sample app showing such more advanced usages "soon" Yes, it works. BLOBs can be mapped to either Uint8Array or to OracleBlob which is a JavaScript wrapper for the Oracle BLOB type.
  • Are there complete applications that already exist that have JavaScript in apex, and if there is, please send me the links for these examples?
    possibly, but I don't know of one to be public. 21c was more of an experimental release, and 23c (developer version) has just been released. I think it will still take a bit until we see complete applications
  • Can collections be integrated into JavaScript? Use values from collections inside JavaScript?
    Sure. but you'll need to wrap your apex_collection API calls in apex.conn.execute calls, pass in the bind variables, etc. we're definitely looking to implement JS wrappers for these common PL/SQL APIs, but until then, it can be done with some custom code
  • From which version of apex MLE libraries are available?
    First of all, you need an Oracle Database 23c to enable modules. From the APEX side, APEX 22.2 would be enough, but if you want to import from URL, you’d need APEX 23.1.
    You can create MLE modules in Object Browser since 22.2! But you'll need DB 23c to do that of course. however, you'll get the best experience in the latest APEX version => 23.1
  • Python would make sense Lucas May I ask you to elaborate a little?
    “Just” Python scripts, or would you need specific libraries as well?
  • Both I guess, I don't regularly use Python, def an amatuer, I just know it's popular in the data science, analytics etc. and if exisiting libraries could be loaded into and called within the oracle db it could be very powerful.
    Thanks for your input, this is very valuable!
  • I agree with Paul about the Python integration. Most of the libraries I’m interested in are Data Science ones, but not only. And just like JavaScript, Python is very popular and the developer community is just as big.
    Thanks for your input, this is very valuable!
  • Other very important use, personally for me is the use of Python for communication with iOT devices. Most of them have support for C and Python. What I currently do for integrating such into APEX applications is communicating through ORDS REST services. Thanks for having it in mind.
    I’m unsure I fully understand the question. Can you please confirm that you would like the IoT devices to communicate _with_ the database via ORDS?
  • No, I’d be happy if I could run Python from the database the same way we now do it for Javascript. Then I would be able to use the Python libraries for communication with iOT devices directly. REST services are the way I now do it - Python program on one server, getting the data from the devices and then transfering data to the APEX applications via REST services. Hope I managed to explain it relatively well.
    Wouldn’t you anyway have to go though some kind of network to talk to the iOT devices?
  • Is there a difference between "Professional" or "Specialist" when it comes to the certification or are the terms interchangeable?
    The professional course and certification is the new course we launched recently.
  • In which situation do we need to use Javascript in APEX?
    You don't _need_ to use it, but you can. there are a number of situations: 1) you know js better than plsql 2) js can do some things better than plsql (e.g regex, strings) 3) there exists an open source javascript library for a specific task 4) some would argue it's just nicer 👀
  • Can we refer application item using apex_env.bind_variable syntax?
    apex.env.MY_APP_ITEM should work just fine, yes
  • We have ATP database 19c when will our instance be eligible to upgrade to 23c?
    23c free is available today, but 23C is not generally available yet - so give it time
  • Can we use module in SQL Developer web snippets?
    I believe so. Please see this blog post: https://www.thatjeffsmith.com/archive/2023/04/oracle-23c-free-developer-release-mle-js-modules-snippets/
  • Where is create MLE module in 23.1?
    The documentation set for Oracle Database 23c - Free Developer Release has been updated for MLE: there is a JavaScript Developer’s Guide covering these concepts in detail, and all the syntax can also be found in the SQL Language Reference. https://apex.oracle.com/go/js-dev-guide
  • Did mle-js-fetch use default db wallet when accessing https or does it use apex wallet?
    It uses default wallet or you can set it with something like the following PL/SQL snippet (called from PL/SQL or JavaScript): CREATE OR REPLACE PROCEDURE SET_WALLET AS BEGIN utl_http.set_wallet('file:<path-to-wallet>’) END /
  • Did MLE module acquire dependencies from server-side dynamically, or should we care about it in APEX applications?
    Please rephrase the question. not exactly sure what you mean. is this related to modules calling other modules? or modules accessing session state? what server-side dependencies exactly?
  • Without db23c what difference between apex23.1 and apex22.2 about “but if you want to import from URL, you’d need APEX 23.1.”
    JavaScript Modules and Environments require Oracle Database 23c Free-Developer Release.
Post Details
Locked on Jun 27 2023
Added on Jun 26 2023
0 comments
292 views