Connecting to Oracle database with Node.js Windows

Go To StackoverFlow.com

6

I am trying to connect to an Oracle database from Node.js in Windows 7. Is this possible? I have not found a plugin for Node.js which will do this for Windows. Are there any recommended work arounds for this? I am guessing there is at least one other person wanting to use Node.js on Windows and needs to connect to Oracle. I'm open to simple workarounds if that is necessary. Thanks for the help.

2012-04-04 19:11
by Matthew Crews
A simple work around is using a C++ oracle driver and exposing access to it as a c++ extension to nod - Raynos 2012-04-04 19:19
Do you have any recommended resources for going about that? I am suspecting I'll have to do something like that but I'm looking for guidance. Thanks for the comment - Matthew Crews 2012-04-04 19:25
Steal the source code of similar projectsRaynos 2012-04-04 19:27
I'm in a similar boat, did you have any luck with this - Danny C 2012-08-01 11:13
I'm sorry but I didn't. Ultimately what I had to do was have a Powershell script pull that data out of the database and dump it into a CSV. I then had NodeJS pull the data into MongoDB. I'm sorry I don't have better news for you - Matthew Crews 2012-08-05 15:56


2

Do you need to connect directly from Node.js to oracle? You could write your database transactions in another language and expose them to Node.js via a web service.

2012-04-04 22:59
by Matthew Watson
Ideally I would connect directly to Oracle from Node.js. If this isn't feasible I'd like to know the easiest workaround. I'm not sure how writing the transactions in another language would work. If there is an example on how to do this, I'd love to see it - Matthew Crews 2012-04-05 04:40
I've that the easiest solution would be to create a data provider using another language which has more support. I'm going to try compiling a native module and found this link to be a good starting point: https://github.com/saary/node.ne - Matthew Crews 2012-04-05 13:52


1

There is a driver made by Oracle oracledb http://www.oracle.com/technetwork/database/database-technologies/node_js/oracle-node-js-2399407.html

UPDATE: Oracle has released a node-oracledb driver on GIT that will allow a nodejs application to connect to oracle DB on windows.

2015-06-12 18:48
by Roia
Hi, welcome to SO! Please provide some example code or elaborate on your answer: link-only answers tend to become stale as hyperlinks die. Anything else you can add to your answer to provide some context - Benny Bottema 2015-06-12 18:56


1

The state of database drivers for node.js on Windows seems somewhat immature compared to the robust and highly performant database drivers we have had available in ADO.NET for years.

I would seriously consider using Edge to call C# or a CLR assembly in-process to access your database. You could write a Repository style data access layer in C# and call it from node.js.

I have proven this works in a development context with C#, PetaPoco (optional), .NET 4.5 and the Oracle ODP driver (Oracle.DataAccess.dll). This should also work with any database that you can talk to in .NET.

Node (server.js) example to call .NET CLR function:

var edge = require('edge');

// define CLR function proxy
var getData = edge.func({
    assemblyFile: '../Repositories/bin/Debug/Repositories.dll',
    typeName: 'Repositories.TestRepository',
    methodName: 'GetData' // This must be Func<object,Task<object>>
});

// call proxy function
getData({ myParam:1 }, function (error, result) {
    if (error) throw error;
    console.log(result);
});

GetData C# looks like this (note you need to put your connection string in node.exe.config in the folder that contains node.exe):

public async Task<object> GetData(object param)
{
    using (var db = new Database("NameOfConnString"))
    {
        return db.Fetch<dynamic>("SELECT * FROM sometable");
    }
}

(Note that Oracle.DataAccess.dll needs to be in the folder that contains node.exe.)

2015-10-08 02:09
by saille


0

http://github.com/mariano/node-db-oracle This project aims to add oracle support to nodejs

EDIT: There is now an office nodejs driver for Oracle, by Oracle called node-oracle

https://blogs.oracle.com/opal/entry/introducing_node_oracledb_a_node

2012-04-12 21:14
by mwrf
Doesn't work on windows unfortunetl - Matthew Crews 2012-04-16 19:37


0

This driver works on Window: https://npmjs.org/package/oracle

A similar question as yours here on Stack Overflow: Connect Node.js with Oracle on Windows platform

2013-09-20 10:23
by Filip
Ads