Author: Anthony Tauro, Performance Architects
Since 2009 when it was first written, Node.js has grown to become a colossus in the open-source software community. Initially Linux-only, today it is a cross-platform JavaScript runtime environment for building a variety of tools and applications.
While it does not have much of a direct impact for those of us working on Oracle’s Business Intelligence and Enterprise Performance Management toolsets, its versatility means it is a tool worth having or at least knowing about for BI and EPM pros.
Node.js is based on the Google Chrome V8 JavaScript engine. This is the engine that helps the Chrome browser enable smooth application performance for Gmail and Google Docs. Though many people mistakenly assume JavaScript is a “mere scripting” language and thus inferior to a “full” language like Java or C#, the reality is that without the power of JavaScript, modern web applications which do much of their processing in the browser would have been impossible. Unlike the “full” languages which have a significant “build” phase, JavaScript applications (essentially web pages) need to be built during that tiny time interval between the web page loading in the browser, and it being shown to the user. And everybody wants that time to be as short as possible. The V8 engine (for a while at least) did this better than anyone else. So in 2009, Ryan Dahl took this engine and built it into a platform for building server applications.
But what truly makes node.js great happened the next year when Isaac Z. Schlueter built the Node Package Manager– or “npm” for short. With npm, people could write node modules and publish them online. Other developers could then (with a short, single command) import these modules into their code. This has spawned an ecosystem of thousands of free and open-source plugins, many of which are enterprise-grade and some of which are used in the biggest web applications in the world today. For example, Express.js is a very popular web framework, and Sails.js is an MVC framework for building enterprise-grade applications.
Oracle provides the Node-oracledb driver, which lets Node applications access the Oracle database (not the only way to connect Node to Oracle). This means you can create a node.js application that connects to an Oracle database, and then you can use a wide variety of other plug-ins to do stuff like expose that database using a web framework, or connect to another non-Oracle data repository like SharePoint or a REST API to supplement/complement the database.
Though the possibilities are literally limitless, in our BI and EPM projects we use this connector in only small ways. Here are some examples:
- For a reporting application, we needed to compare the results of our reporting queries with some Excel reports (which we were working to replicate, albeit from a different source). The comparisons needed to be automated as the queries were being constantly tweaked, and source data also regularly reloaded. The workbook had several worksheets, the data was formatted into a pivot-table structure and column structure was a little flexible. We wrote a node application that read all the files in a nested folder structure, identified the right data, and imported it into a table in a flattened format. Then PL/SQL queries took over from there.
- For a geomapping dashboard we needed to get latitude-longitude information for a list of customer addresses. We wrote a quick node application to get the coordinates from the Google Geomapping API, which has a relatively generous (but not unlimited) free quota, and plugged that back into the Oracle table.
- To build a simple dashboard to track incoming data files, we used a node application that read the ETL application logs from a table, along with file details from an FTP folder, and presented a consolidated picture in an easily navigable web page.
- EPM (while very intuitive for us pros), presents some challenges for more casual users. Fortunately, Oracle’s team has been giving it decent REST API capabilities, especially for PBCS. This allows a node.js application to connect to PBCS and present a much simplified interface for its users as required. While the Oracle JET (JavaScript Extension Toolkit) provides a good toolset for UI development, customers can also use whatever toolset they prefer.
This post is an introduction to Node.js for BI and EPM consultants. In subsequent posts we will look at some features of the oracle-nodedb connector, installing Node and the connector, and creating a simple application to view and navigate a table.