oracle nodejs 访问

时间:2023-03-09 09:12:46
oracle nodejs 访问

1. 下载node-oracle网址如下:

https://github.com/joeferner/node-oracle

2. 测试代码:

var oracle = require('oracle');

var connectData = {
hostname: "localhost",
port: 1521,
database: "xe", // System ID (SID)
user: "oracle",
password: "oracle"
} oracle.connect(connectData, function(err, connection) {
if (err) { console.log("Error connecting to db:", err); return; } connection.execute("SELECT systimestamp FROM dual", [], function(err, results) {
if (err) { console.log("Error executing query:", err); return; } console.log(results);
connection.close(); // call only when query is finished executing
});
});
对于详细的信息可以参考上面的网址