[Nodejs] node-adodb 讀取.mdb檔案
- https://www.npmjs.org/package/node-adodb
- Simple Query:
const ADODB = require('node-adodb');
const connection = ADODB.open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=node-adodb.mdb;');
connection
.query('SELECT * FROM TABLE_NAME') // query method return Promise
.then(data => {
console.log(JSON.stringify(data, null, 2));
})
.catch(error => {
console.error(error);
});
- 依據Access版本不同,在ADODB.open時指定不同的連接字串
- Access 2000-2003 (*.mdb):
- Provider=Microsoft.Jet.OLEDB.4.0;Data Source=node-adodb.mdb;
- Access > 2007 (*.accdb):
- Provider=Microsoft.ACE.OLEDB.12.0;Data Source=adodb.accdb;Persist Security Info=False;
- Provider=Microsoft.ACE.OLEDB.15.0;Data Source=adodb.accdb;Persist Security Info=False;
沒有留言:
張貼留言