通过 nodejs 访问 .mdb 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21426935/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 16:46:49  来源:igfitidea点击:

Accessing .mdb files through nodejs

node.jsms-access-2007npm

提问by Beast

I want to Access .mdb files and manipulate like insert / update using nodejs

我想访问 .mdb 文件并使用 nodejs 进行插入/更新等操作

Please suggest a library that would suite the need.

请推荐一个可以满足需求的图书馆。

Thanks.

谢谢。

回答by Rob Campion

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

略有不同,但 node-adodb 对于 .accdb 文件对我来说效果很好:

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

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);
    })

回答by Mike Causer

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

本文介绍了将 PHP 连接到 Access .mdb 数据库的过程: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.

Node.js 的过程非常相似——它只是另一个 ODBC 数据源。

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

您将需要一个节点 ODBC 包,例如: https://github.com/wankdanker/node-odbc

https://github.com/markdirish/node-odbc/

https://github.com/markdirish/node-odbc/

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

然后您需要格式化您的 ODBC 连接字符串。例如。

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

回答by Michael Oskroba

My suggestion is OWIN modulewhich is currently developed as Edge.jsby Mr Tomasz Janczuk.

我的建议是OWIN 模块,它目前由 Tomasz Janczuk 先生开发为Edge.js。