Node connects to Oracle

Source: Internet
Author: User

Using node to connect Oracle It takes a little time to install the environment for those of you who have just started the node project or used MySQL before.

Mirror

Npm:https://www.npmjs.com/package/oracle

Taobao:https://npm.taobao.org/package/oracle

Note: on the Taobao mirror there is an eye-catching description of this library was not maintained. Oracle has made there own driver. "So I'm using the NPM image here.

install oralce Before you need to configure some environment, the above two mirrors have a description, specific can refer to: Https://github.com/xianglongxiang/node-oracledb, Here is a step I installed:

First, the Installation tool

1. Install Python 2.7:https://www.python.org/download/releases/2.7/

Installation succeeded:

2. To install GCC, Visual Studio, or similar, I am installing Visual Studio:

Visual studio:https://www.visualstudio.com/

Installation succeeded:

3. Installing Oracle's client and SDK

Client and Sdk:http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

If you do not have an account, you can download it here

Client: Http://pan.baidu.com/s/1nuOg9QT

Sdk:http://pan.baidu.com/s/1ererzbs

Extract Instantclient_basic-windows.x64-12.1.0.2.0.zip and instantclient_sdk-windows.x64-12.1.0.2.0.zip to the same directory folder ", pay special attention to the same directory folder below.

Configure the folder address to the environment variable: C:\oracle\instantclient .

If the above tools are installed, there is no problem doing one of the following steps

Second, install node, here Unknown solution, specific to see node official website, https://nodejs.org/en/

Third, through visual Studio configuration

Open Visual Studio, Tools->nuget Package Manager, package management Console, enter the following command

Set Oci_lib_dir=c:\oracle\instantclient\sdk\lib\msvc
Set Oci_inc_dir=c:\oracle\instantclient\sdk\include

Iv. installing NPM To install the Oracle driver

Use the CMD or Editor console npm install Oralcedb--save

If this can be installed successfully, the Orace driver has been completed.

Five, test whether the connection is successful

var oracledb = require (' OracleDB ');
Oracledb.getconnection ({
ConnectString: "172.16.1.219/orcl",
User : "Test",
Password : "Test"
},function (err, connection) {
if (err) console.error (err.message);
Console.log ("Connection succeeded")

});

  



Node connects to Oracle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.