The state of the database drivers for node.js on Windows seems somewhat immature compared to the reliable and high-performance database drivers that we have had in ADO.NET for several years now.
I would seriously consider using Edge to call C # or build the CLR in the process to access your database. You can write a Repository level of access to style data in C # and call it from node.js.
I have proven that this works in the context of development with C #, PetaPoco (optional), .NET 4.5 and Oracle ODP driver (Oracle.DataAccess.dll). This should also work with any database you can talk to in .NET.
Node (server.js) to call the .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 that you need to put the connection string in node.exe.config in the folder containing node.exe):
public async Task<object> GetData(object param) { using (var db = new Database("NameOfConnString")) { return db.Fetch<dynamic>("SELECT * FROM sometable"); } }
(Note that the Oracle.DataAccess.dll file must be located in the folder containing node.exe.)
source share