Connecting Python and Node.js a pplications on Linux on Power Systems t ...

Connecting Python and Node.js applications on Linux on Power Systems

to Oracle databases

Using cx_Oracle and node-oracledb modules

........

Arun Sar Krishna Harsha Voora Mithun Hallikerehundi

Srirama Sharma IBM Cognitive Systems

August 2018

? Copyright IBM Corporation, 2018

Table of contents Abstract..................................................................................................................................... 1 Introduction .............................................................................................................................. 1 Overview ................................................................................................................................... 2 Installation and configuration of cx_Oracle ........................................................................... 3

Important connection parameters ............................................................................................................ 4

Installation and configuration of node-oracledb .................................................................... 4 Summary ................................................................................................................................... 7 Resources ................................................................................................................................. 8 About the authors..................................................................................................................... 8 Trademarks and special notices ........................................................................................... 10

Connecting Python and Node.js applications on Linux on Power Systems to Oracle databases ? Copyright 2018, IBM Corporation

Abstract

In the era of artificial intelligence (AI) and running microservices in containers, Python and Node.js are choices for building present generation applications. These applications may require connecting to various data sources for different types of the data. Because many customers use Oracle Database as their operational database, the cx_Oracle and nodeoracledb modules provides an easy connectivity to an Oracle Database running on any platform. The validation work confirms that Python or Node.js application, using cx_Oracle or node-oracledb respectively, running on Linux? on IBM? Power SystemsTM can connect to an Oracle Database running on IBM AIX?. Overall availability of these modules on Linux on Power? makes it easy for application developers to write the code and integrate. This enables the IBM PowerAI Enterprise platform to easily connect to an Oracle Database as one of the data sources.

This paper provides the commands and step-by-step guidance on how to establish connectivity to an Oracle Database using the node-oracledb and cx_Oracle modules.

Introduction

Linux on Power Systems provides an open and scalable infrastructure that is built to process a massive amount of data quickly, efficiently, and cost-effectively to formulate real-time actionable business insight. The Linux ecosystem alongside with legacy IBM AIX workloads provide a stronger value to the business that is looking for modernizing its operation using artificial intelligence, machine learning, and deep learning frameworks.

Python is widely used in the industry in numerous fields such as scientific packages, mathematical libraries, and web applications. JavaScript is one of the vital components of World Wide Web (WWW) along with HTML and CSS. Because it is lightweight and has attributes for ease of use, JavaScript has been widely considered in all the websites. Most of the web browsers have a dedicated engine to process JavaScript. Node.js is a server platform built on JavaScript and contains numerous JavaScript modules with features such as non-blocking I/O, which makes Node.js one of the most widely used platforms to develop scalable web and network applications. The cx_Oracle and node-oracledb modules come in handy and provide standard interface to connect applications developed using Python and Node.js with an Oracle Database.

IBM PowerAI is a software toolkit with deep learning frameworks and building block software designed to run on IBM's highest performing server. PowerAI makes deep learning, machine learning, and AI more accessible and more performant. By combining this software platform for deep learning with IBM Power Systems, enterprises can rapidly deploy a fully optimized and supported platform for AI with blazing performance. The PowerAI platform includes the most popular deep learning frameworks and their dependencies, and it is built for easy and rapid deployment.

Many Python and Node.js applications use deep learning or machine learning frameworks to create trained models. The accuracy of those models heavily depends on a range of vast data from different sources. One of the databases most widely used in the enterprise systems is the Oracle Database. This paper provides a brief overview and the steps to configure and use cx_Oracle and node-oracledb connectors.

Connecting Python and Node.js applications on Linux on Power Systems to Oracle databases ? Copyright 2018, IBM Corporation

1

Overview

cx_Oracle is a Python extension module that can be used to enable access to an Oracle Database. The recent version of cx_Oracle is 6 and has been tested to work with Python versions 2.7 and 3.4. cx_Oracle can be used with Oracle Database 11.2, 12.1, and 12.2 libraries. cx_Oracle is an open source project licensed under BSD terms and is maintained by Oracle.

GitHub link for cx_Oracle is .

The node-oracledb add-on for Node.js allows high performance Oracle Database applications which are developed using Node.js and Python. Node.js is an open source, cross-platform runtime environment for writing mid-tier and networking applications in JavaScript. The node-oracledb driver connects to an Oracle Database for fast and functional applications. It is an open source project with Apache 2.0 license. It is maintained by Oracle and is under active development.

GitHub link for node-oracledb .

AIX

Linux

Figure 1: node-oracledb and cx_Oracle with enterprise applications

Figure 1 depicts IBM Power servers with an Oracle Database running on AIX operating systems. Many PowerAI frameworks, web applications, UI frameworks, mathematical, scientific and numerical libraries and applications can run on a powerful IBM POWER9TM processor-based servers, such as the IBM Power System model AC922.

Connecting Python and Node.js applications on Linux on Power Systems to Oracle databases ? Copyright 2018, IBM Corporation

2

cx_Oracle and node-oracledb, along with Oracle instant client provide built-in functions to connect the Oracle Database to applications built using Python and Node.js respectively, in preparing this document these were run on LoP.

Installation and configuration of cx_Oracle

This section provides the steps to install and configure cx_Oracle and node-oracledb plug-ins for applications running on Linux on Power Systems to access the Oracle Database. Perform the following steps to download and configure python-pip and cx_oracle on UBUNTU 16_04 LTS ppc64le.

1. Install python pip. pip is a package management system used to install and manage software packages written in Python.

$ apt-get install python-pip

2. Using the python pip install and upgrade cx_oracle package.

$ python -m pip install cx_oracle ?upgrade

3. Download the Oracle instant client available from the Oracle technology network at:

4. Create a directory and extract the instant client in the directory using the following commands.

$ mkdir -p /opt/oracle $ unzip instantclient-basic-linux.leppc64.c64-12.2.0.1.0.zip

5. Create the necessary links and add the files to the library path using the following commands.

$ sudo sh -c "echo /opt/oracle/instantclient_12_2 > /etc/ld.so.conf.d/oracleinstantclient.conf" $ sudo ldconfig $ export LD_LIBRARY_PATH=/opt/oracle/12.2/client64/lib:$LD_LIBRARY_PATH

6. Refer to the following URL to set up a schema for cx_oracle, examples demonstrate connectivity to the Oracle Database.

7. Navigate to the sql folder section under the sample section. Then, download and run the following SQL files: ? DropSamples.sql ? SampleEnv.sql ? SetupSamples.sql

8. Download any sample copy (for example sampleEnv.py) to the folder where the SQL files are present, modify the parameters in the sampleEnv.py file as per the Oracle instance details and run the example file.

Connecting Python and Node.js applications on Linux on Power Systems to Oracle databases ? Copyright 2018, IBM Corporation

3

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download