Skip to content

juliandavidmr/ddlify-oracle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ddlify: Oracle database bindings for Node.js

Features

  • Promises
  • All version information
  • Connect
  • DDL
  • Describe procedures
  • Describe tables
  • Describe views
  • Describe secuences
  • Describe triggers
  • Describe procedures
  • Create models
  • Create schemas
  • Listing models

Installation

[IMPORTANT] First step, it is important to follow the installation guide before continuing. Installation guide

# Not available yet
$ npm install --save ddlify

API

Connect database

Connect to a local or remote database.

var ddlify = require('ddlify');


var dbConfig = {
    user: process.env.NODE_ORACLEDB_USER || "hr",

    // Instead of hard coding the password, consider prompting for it,
    // passing it in an environment variable via process.env, or using
    // External Authentication.
    password: process.env.NODE_ORACLEDB_PASSWORD || "welcome",

    // For information on connection strings see:
    // https://github.com/oracle/node-oracledb/blob/master/doc/api.md#connectionstrings
    connectString: process.env.NODE_ORACLEDB_CONNECTIONSTRING || "localhost/orcl",

    // Setting externalAuth is optional.  It defaults to false.  See:
    // https://github.com/oracle/node-oracledb/blob/master/doc/api.md#extauth
    externalAuth: process.env.NODE_ORACLEDB_EXTERNALAUTH ? true : false
};

ddlify.getConnection(dbConfig).then(connection => {
    console.log("Connection:\n", connection)
});

Get oracle information

ddlify.info(dbConfig).then(info => {
    console.log("Info:\n", info);
    /*=>
    Info:
    ['Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit   Production',
     'PL/SQL Release 12.1.0.2.0 - Production',
     'CORE 12.1.0.2.0 Production',
     'TNS for 64-bit Windows: Version 12.1.0.2.0 - Production',
     'NLSRTL Version 12.1.0.2.0 - Production' ]
    */
});

Describe table

var table = {
  name: 'USUARIO',
  owner: 'VISIBILIDAD'
}

ddlify.describe(table, dbConfig).then(info => {
  console.log(info)
});

Contributing

Ddlify-oracle is an open source project. See CONTRIBUTING for details.

LICENSE

This module is released under the [MIT License] license. @juliandavidmr