我已使用npm install jdbc
在我的32位jdbc
操作系统中安装Linux
节点模块。我写了一个节点代码:
var jdbc = new ( require('jdbc') );
var config = {
libpath: __dirname + 'path/to/jdbc.jar',
drivername: 'cs.jdbc.driver.CompositeDriver',
url: connectionurl,
// optionally
user: username,
password: password,
};
app.get('/jdbctry', function (req, res) {
jdbc.initialize(config, function(err, res) {
if (err) {
console.log(err);
}
});
var genericQueryHandler = function(err, results) {
if (err) {
console.log(err);
} else if (results) {
console.log(results);
}
jdbc.close(function(err) {
if(err) {
console.log(err);
} else {
console.log("Connection closed successfully!");
}
});
};
jdbc.open(function(err, conn) {
if (conn) {
// SELECT statements are called with executeQuery
jdbc.executeQuery("SELECT * FROM table", genericQueryHandler);
}
});
});
我已经在我的本地系统中运行它并且完全正常。
但我的要求是在另一台32位Linux
计算机上运行它而无法访问Internet。我将代码和jdbc
模块移动到另一个系统,并尝试运行它,我收到以下错误:
Module._extensions[extension](this, filename);
^
Error: libjvm.so: cannot open shared object file: No such file or directory
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous (/common/node_modules/jdbc/node_modules/java/lib/nodeJavaBridge.js:10:16)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)