egg-oracle
TypeScript icon, indicating that this package has built-in type declarations

4.0.1 • Public • Published

egg-oracle

NPM version David deps Known Vulnerabilities npm download

Install

See Quick Start Node-oracledb Installation.

$ npm i egg-oracle --save

Usage

  • enable plugin
// {app_root}/config/plugin.js
exports.oracle = {
  enable: true,
  package: 'egg-oracle',
};
  • oracle connection pool attach in app
// {app_root}/app/service/my_service.js
'use strict';
const Service = require('egg').Service;

class MyService extends Service {
  // example for getConnection
  async foo() {
    const connection = await this.app.oracle.getConnection();
    const result = await connnection.execute('SELECT sysdate AS "date" FROM dual');
    connection.close();
    console.log(result.rows[0].date);
  }
}
module.exports = MyService;

Documentation

See Documentation for the Oracle Database Node.js Add-on.

Configuration

// {app_root}/config/config.default.js
exports.oracle = {
  client: {
    user: 'user',
    password: 'password',
    connectString: 'localhost/orcl',
  },
};

see config/config.default.js for more detail.

Example

License

MIT

Package Sidebar

Install

npm i egg-oracle

Weekly Downloads

32

Version

4.0.1

License

MIT

Unpacked Size

8.73 kB

Total Files

9

Last publish

Collaborators

  • cuyl