All Projects → bomsy → Node Odp

bomsy / Node Odp

A node library that wraps the odp.net dll to provide bindings to oracle on windows

Labels

Projects that are alternatives of or similar to Node Odp

Openrecord
Make ORMs great again!
Stars: ✭ 474 (+5166.67%)
Mutual labels:  oracle
Laravel Oci8
Oracle DB driver for Laravel 4|5|6|7|8 via OCI8
Stars: ✭ 639 (+7000%)
Mutual labels:  oracle
Ezsql
PHP class to make interacting with a database ridiculusly easy
Stars: ✭ 804 (+8833.33%)
Mutual labels:  oracle
Learning Library
Learning Material for Oracle Technologies
Stars: ✭ 512 (+5588.89%)
Mutual labels:  oracle
Dbshield
Database firewall written in Go
Stars: ✭ 620 (+6788.89%)
Mutual labels:  oracle
Blog
Everything about database,business.(Most for PostgreSQL).
Stars: ✭ 6,330 (+70233.33%)
Mutual labels:  oracle
Testcontainers Spring Boot
Container auto-configurations for spring-boot based integration tests
Stars: ✭ 460 (+5011.11%)
Mutual labels:  oracle
Oracle Db Examples
Examples of applications and tool usage for Oracle Database
Stars: ✭ 843 (+9266.67%)
Mutual labels:  oracle
Sqlinjectionwiki
A wiki focusing on aggregating and documenting various SQL injection methods
Stars: ✭ 623 (+6822.22%)
Mutual labels:  oracle
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (+8511.11%)
Mutual labels:  oracle
Tadpolefordbtools
Stars: ✭ 523 (+5711.11%)
Mutual labels:  oracle
Mormot
Synopse mORMot ORM/SOA/MVC framework
Stars: ✭ 607 (+6644.44%)
Mutual labels:  oracle
Zxw.framework.netcore
基于EF Core的Code First模式的DotNetCore快速开发框架,其中包括DBContext、IOC组件autofac和AspectCore.Injector、代码生成器(也支持DB First)、基于AspectCore的memcache和Redis缓存组件,以及基于ICanPay的支付库和一些日常用的方法和扩展,比如批量插入、更新、删除以及触发器支持,当然还有demo。欢迎提交各种建议、意见和pr~
Stars: ✭ 691 (+7577.78%)
Mutual labels:  oracle
Docker Images
Official source for Docker configurations, images, and examples of Dockerfiles for Oracle products and projects
Stars: ✭ 5,120 (+56788.89%)
Mutual labels:  oracle
Phila Airflow
Stars: ✭ 16 (+77.78%)
Mutual labels:  oracle
Jooq
jOOQ is the best way to write SQL in Java
Stars: ✭ 4,695 (+52066.67%)
Mutual labels:  oracle
Vagrant Projects
Vagrant projects for Oracle products and other examples
Stars: ✭ 642 (+7033.33%)
Mutual labels:  oracle
Apex App Crappybird
Oracle APEX Application - CrappyBird / Social Game
Stars: ✭ 8 (-11.11%)
Mutual labels:  oracle
Experdb Db2pg
eXperDB-DB2PG is a data migration solution that transfers data extracted from various DBMSs to eXperDB or PostgreSQL. Currently, Oracle and Oracle Spatial, MySQL, SQL Server(MS-SQL) and Sybase data can be transferred.
Stars: ✭ 24 (+166.67%)
Mutual labels:  oracle
K8cscan
K8Cscan大型内网渗透自定义插件化扫描神器,包含信息收集、网络资产、漏洞扫描、密码爆破、漏洞利用,程序采用多线程批量扫描大型内网多个IP段C段主机,目前插件包含: C段旁注扫描、子域名扫描、Ftp密码爆破、Mysql密码爆破、Oracle密码爆破、MSSQL密码爆破、Windows/Linux系统密码爆破、存活主机扫描、端口扫描、Web信息探测、操作系统版本探测、Cisco思科设备扫描等,支持调用任意外部程序或脚本,支持Cobalt Strike联动
Stars: ✭ 693 (+7600%)
Mutual labels:  oracle

NODE-ODP

NPM

A node library that wraps the Oracle Data Provider for.NET (ODP.NET) library to provide bindings to oracle on windows.

Requirements

Install ODAC, making sure the policy dlls are shared (placed in the GAC). See installation instructions here

Install Microsoft visual C++ 2010 redistributable package (x86 or x64 or both).

x86

x64

Update: Install Node v0.10.x

Installation

npm install node-odp

How to use (Sample code) Edit to fit your scenario

var odpnode = require('node-odp');
var con = new odpnode.OracleConnection("Data Source=mhladmin;User Id=/;");

var parameterDirection = odpnode.OracleData.parameterDirection;
var datatypes = odpnode.OracleData.dbType;
var cmdType = odpnode.OracleCommand.commandType;

con.open();
var parameters = [
    {
	    name: "vResult",
	    type: datatypes.VARCHAR2,
	    size: 4000,
	    value: '',
	    direction: parameterDirection.OUTPUT
    },
    {
	    name: "pFOLDERID",
	    type: datatypes.INT32,
	    value: "1845",
	    direction: parameterDirection.INPUT
    }	
]

//SIMPLE SELECT STATEMENT
var cmdSelStatement = new odpnode.OracleCommand("SELECT m.FOLDERID,m.ZONE.ZONECODE FROM MID.MIFOLDER2 m,MID.MIVERSION s WHERE m.VERSION.VERSIONID = s.VERSIONID AND  m.ZONE.ZONECODE ='chwhrf-bldg'", cmdType.TEXT, con);
cmdSelStatement.executeReader(function(err, rows){
    if(err){
	    console.log(err);
    }else{
	    console.log(rows);
	    console.log(rows[1]["ZONE_ZONECODE"]);
    }	
});

//ORACLE FUNCTION WITH PARAMETERS
var cmdProc = new odpnode.OracleCommand("BEGIN :vResult := MID.MI_MAXSCRIPT.MITest( :pFOLDERID ); END;", cmdType.TEXT, parameters, con);
cmdProc.executeNonQuery(function(err, rowsAffected, params){
    if(err){
	    console.log(err);
    }else{
	    console.log(params);
    }	
});

var refParams = [
    {
        name: 'pJOBCODE',
        type: datatypes.VARCHAR2,
        value: "2378",
        direction: parameterDirection.INPUT,
        size: 2000
    },{
        name: 'pFilterDescription',
        type: datatypes.VARCHAR2,
        value: "",
        size: 2000,
        direction: parameterDirection.OUTPUT
    },{
        name: 'resultset',
        type: datatypes.REFCURSOR,
        size: 2000,
        value: "",
        direction: parameterDirection.OUTPUT
    }
];

//RETURNING REFCURSORS
var refCmd = new odpnode.OracleCommand("MID.MICHUNK_API.GetChunksByJob_cursor", commandType.STOREDPROCEDURE, refParams, con);
refCmd.executeReader(function(err, rowset){
    if(err){
        console.log(err);
    }else{
        console.log(rowset);
    }
});

API Definition

ORACLECONNECTION

OracleConnection(connectionString);

The constructor takes the connectionString as parameter and returns a new connection object. The connection string is any valid Oracle connection string. For oracle connectionstring formats see here

.open

The open method opens the connection

ORACLECOMMAND

OracleCommand(commandString, commandType, commandParameters, connectionObject);

The constructor takes in parameters and returns a new command object

commandString

This can either be a select statement or an oracle function call as shown in the sample code above. This is a required parameter.

commandType

This an object of the OracleCommand.commandType enumeration object. This is a required parameter.

commandParameters

This an array of parameter objects as shown above. Each parameter object is defined as

{
	name: parameterName,
	type: dataTypeObject,
	size: size(optional),
	value: parameterContent,
	direction: parameterDirectionObject
}

This parameter is optional.

connectionObject

This is a connection object created by OracleConnection. This is a required parameter.

.executeReader

executeReader(function(err, rows){

})

This function takes a callback and passes the err and rows objects to that callback.

The err object holds the error if there is any and undefined if there is none.

The rows holds the JSON object of the rows returned. These rows are identified by their row numbers and column names as shown in the sample code above.

.executeNonQuery

executeNonQuery(function(err, rowsAffected, parameters){

})

This function takes a callback and passes the err, rowsAffected and parameters objects to the callback.

The err object holds the error if there is any and undefined if there is none.

The rowsAffected returns the number of rows Affected by current execution, but returns -1 if there is none.

The parameters object returns all the parameters attached to the command, allowing for access to any out or in/out parameter data.

.executeScalar

executeScalar(function(err, rowsAffected, parameters){

})

Sames as for executeNonQuery

.commandType

Oracle Command Constants for defining data text type

            commandType.TEXT
                        .STOREDPROCEDURE

returns constants defining the type of the command.

ORACLEDATA

A data object storing key/value pairs of constants representing various oracle types

.parameterDirection

Various constants for specifying parameter direction

parameterDirection.INPUT
                  .OUTPUT
                  .INPUTOUTPUT
                  .RETURNVALUE

.dbType

Various constants for specifying data types

            dbType.BFILE
                 .BLOB
                 .BYTE
                 .CHAR
                 .CLOB
                 .DATE
                 .DECIMAL
                 .DOUBLE
                 .INT16
                 .INT32
                 .INT64
                 .INTERVALDS
                 .INTERVALYM
                 .LONG
                 .LONGRAW
                 .RAW
                 .REFCURSOR
                 .NVARCHAR
                 .SINGLE
                 .TIMESTAMP
                 .TIMESTAMPLTZ
                 .TIMESTAMPTZ
                 .VARCHAR2
                 .XMLTYPE

Release History

v 0.1.0 - just .node file .

v 0.1.1 - added all the source files, updated binding.gyp.

v 0.1.2 - corrections.

v 0.1.3 - bug fixes.

v 0.1.4 - bug fixes.

v 0.1.9 - added dependency dlls to package msvcp100d.dll, msvcr100d.dll.

v 0.1.10 - compiled to 32 bit node.

v 0.1.11 - complied to x64.

v 0.1.14 - fixed exception handling in odpconnection.cc

v 0.1.15 - changed dependency path in and PLATFORM to win32 binding.gyp

v 0.1.18 - updated readme

v 0.1.19 - deps on node-gyp, bindings not needed. updated readme, remove dlls not needed, added 32 bit support

v 0.2.0 - updated to support node v 0.10.0, might not be backward compatible

v 0.2.1 - changed Runtime Library for Release Mode to 'MultiThreadedDLL'. This was causing it not to run on release machines. Now fixed! Unit tests added.

v 0.2.2 - Readme.md fixes

v 0.2.3 - Readme.md corrections

Licence

Copyright (c) 2013 Hubert Boma Manilla
Licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].