node.js 的数据库访问-Oracle (db-oracle)

尝试使用了一下访问Oracle,从网上查到说node.js 不支持 通过 tnsnames.ora配置来访问Oracle,然后从GitHub中抄袭了一段代码来测试(https://github.com/technoweenie/twitter-node/issues/18),测试一直报错,恳请好心人指路,到底什么是option:database 啊??

WARNING: ev_ref is deprecated, use uv_ref
WARNING: ev_unref is deprecated, use uv_unref
CONNECTION ERROR: ORA-12154: TNS:could not resolve the connect identifier specified

var oracle = require('db-oracle');
new oracle.Database({
    hostname: 'localhost',
    user: 'root',
    password: 'password',
    database: 'node'
}).connect(function(error) {
    if (error) {
        return console.log("CONNECTION ERROR: " + error);
    }

    this.query().select('*').from('users').execute(function(error, rows) {
        if (error) {
            return console.log('ERROR: ' + error);
        }
        console.log(rows.length + ' ROWS');
    });
});
posted @ 2013-02-19 15:49  牙齿晒太阳(mi哥)  阅读(934)  评论(0编辑  收藏  举报