Accessing .mdb files through nodejs

断了今生、忘了曾经 提交于 2019-11-28 17:50:59

Slightly different but node-adodb worked well for me for .accdb files:

https://www.npmjs.org/package/node-adodb

// Get the adodb module
var ADODB = require('node-adodb');
ADODB.debug = true;

// Connect to the MS Access DB
var connection = ADODB.open('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\dbs\\my-access-db.accdb;Persist Security Info=False;');

// Query the DB
connection
    .query('SELECT * FROM [TestTable];')
    .on('done', function (data){
        console.log('Result:'.green.bold, data);
    })

This article describes the process for connecting PHP to an Access .mdb database: http://www.sitepoint.com/using-an-access-database-with-php/

The process for Node.js is quite similar - it's just another ODBC data source.

You'll need a node ODBC package, such as: https://github.com/wankdanker/node-odbc

Then you'll need to format your ODBC connection string. eg.

"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=MyDatabase; Uid=; Pwd=;"

My suggestion is OWIN module which is currently developed as Edge.js by Mr Tomasz Janczuk.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!