CNode

Node如何连接Oracle数据库?

Mmoonlight发布于14 年前最后回复12 年前16 回复16948 浏览0 收藏

数据库模块db-oracle

环境win7

版本node-v0.6.19

var oracle = require('db-oracle');

this.query().select('*').from('users').execute(function(error, rows) {
    if (error) {
        return console.log('ERROR: ' + error);
    }
    console.log(rows.length + ' ROWS');
});
查看回复

回复 (15)

M
moonlight#1·14 年前

可能是不会调用的原因。

遇到的错误提示说没有找到指定模块。

错误提示如下:

module.js:337
throw new Error("Cannot find module '" + request + "'");
      ^

Error: Cannot find module './build/Release/oracle_bindings' at Function._resolveFilename (module.js:337:11) at Function._load (module.js:279:25) at Module.require (module.js:359:17) at require (module.js:375:17) at Object. (F:\Market\NodeJSMarke\Web\node_modules\db-oracle\db-o racle.js:18:15) at Module._compile (module.js:446:26) at Object..js (module.js:464:10) at Module.load (module.js:353:31) at Function._load (module.js:311:12) at Module.require (module.js:359:17) worker 352 died

参考:db-oracle

也有可能是Oracle环境变量的配置问题?

J
JacksonTian#2·14 年前

@moonlight 估计模块没有编译。可能这个模块不支持windows。

M
moonlight#3·14 年前

@Jackson 貌似oracle_bindbings.cc文件是Linux/Unix 下的C++源文件

binding = require("./build/Release/oracle_bindings");
M
moonlight#4·14 年前

哪位大虾有在win下面连接oracle例子没 ╮(╯_╰)╭

刚看了另外一个模块node-oracle

对C++不熟悉,好难上手

H
huangdh3#5·14 年前

@moonlight oracle这个有没有安装来着!

M
moonlight#6·14 年前

@huangdh3 有的,目录如下

node_modules

┣db-oracle

┣lib

┣src

 db-oracle.js

 tests.js
X
xuhaijinsky2008#8·14 年前

请问这个搞定了么?windows下可以连oracle玩么。。

X
xieyijun#9·14 年前

我也想知道能否在window下连接oracle

Y
yualone#10·13 年前
引用 moonlight@xuhaijinsky2008 @xieyijun 现在已转为 Linux平台下开发,连接正常 需要编译源码。

您好,请问这个该怎么编译呢?不好意思对C++不熟悉,我测试的时候也是报找不到build/Release/oracle_bindings

R
realcbb#11·14 年前

请教楼主是怎么安装db-oracle的,我也是win7,npm install db-oracle,会报“'node-waf' 不是内部或外部命令,也不是可运行的程序或批处理文件。”

M
moonlight#12·14 年前

@xuhaijinsky2008 @xieyijun 现在已转为 Linux平台下开发,连接正常 需要编译源码。

W
wandaoban#13·13 年前
引用 xieyijun我也想知道能否在window下连接oracle

@xuhaijinsky2008 @xieyijun 最近正好尝试win7下 node.js 连接 oracle, 已成功连上并能执行增/删/改/查的sql. 请移步查看博文: http://my.oschina.net/zenglingfan/blog/164390 或者在 google 里搜索 《Windows7 下 Node.js 连接 Oracle》

Z
zhs077#14·13 年前

加我QQ 436062598我给你个

Y
yanxe#15·12 年前

你好,最近也出现了这个问题: module.js:356 Module._extensions[extension](this, filename); ^ Error: The specified module could not be found.

E:\Workspaces\nodejs\oracle-test\node_modules\oracle\build\Release\oracle_bindings.node at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (E:\Workspaces\nodejs\oracle-test\node_modules\oracle\lib\oracle.js:2:16) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) 你解决了吗

参与回复
登录后即可参与回复。登录