首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Windows平台上从Node.js连接DB2

在Windows平台上从Node.js连接DB2
EN

Stack Overflow用户
提问于 2012-11-08 15:59:45
回答 1查看 1.9K关注 0票数 3

我目前正在使用一些jdbc代码将DB2镜像到本地MySQL-db。我想直接从Node.js应用程序连接DB2,而不必查询镜像。我在Windows上运行,不能切换到Linux。在使用Node.js的DB2上的工作似乎还很微不足道,或者使用了node-odbc (node的unixODBC绑定)。

我找到了这个项目https://github.com/herzi/db2.js,它为节点提供了db2绑定,但是我无法安装它,因为安装失败了。该包需要Node-gyp (安装成功)和.NET框架SDK。我将vcbuild.exe设置到我的路径中。在这些之后,msbuild.exe抱怨缺少头文件(sqlcli1.h,sqlsystm.h,sqlca.h),我发现它们是PRO*C的一部分。

我从这里获取了上面的头文件:http://files.edin.dk/php/win32/dev/php_build/include/db2/,并将它们放入节点的src/目录中。现在编译器显示多个错误。

当使用Windows从Node.js应用程序连接DB2时,除了尝试让上面的模块工作之外,还有其他选择吗?

有谁能帮我一下吗?安装上述模块的步骤是什么?

谢谢!

显示的错误:

代码语言:javascript
复制
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C2146 : syntax error : missing ';' before identifier 'SQLSTATE' [C:\IS\node\node_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C2146: syntax error : missing ';' before identifier 'SQLSTATE' [C:\IS\node\node_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]

C:\Documents and Settings\tpaleniu\.node-gyp\0.8.12\src\sqlcli1.h(1501): error C2371: 'SQLTCHAR' : redefinition; different basic types [C:\IS\node\node_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30) : see declaration of 'SQLTCHAR'

..\src\connection.cc(77): error C3861: 'snprintf': identifier not found 

[C:\IS\node\node_modules\db2\build\db2.vcxproj]..\src\connection.cc(80): error C3861: 'snprintf': identifier not found [C:\IS\node\node_modules\db2\build\db2.vcxproj]

..\src\connection.cc(111): error C3861: 'bzero': identifier not found [C:\IS\node\node_modules\db2\build\db2.vcxproj]

..\src\connection.cc(208): error C3861: 'bzero': identifier not found [C:\IS\node\node_modules\db2\build\db2.vcxproj]

..\src\connection.cc(547): error C2057: expected constant expression [C:\IS\node\node_modules\db2\build\db2.vcxproj]

..\src\connection.cc(547): error C2466: cannot allocate an array of constant size 0 [C:\IS\node\node_modules\db2\build\db2.vcxproj]

..\src\connection.cc(547): error C2133: 'argv' : unknown size [C:\IS\node\node_modules\db2\build\db2.vcxproj]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-10 17:27:48

确实,node-odbc目前仅用于unixODBC。但Daniel VerWeire目前正在研究supporting node-odbc on Windows。我想你需要等一段时间。

一旦可用,Praveen将在它的here上发布一篇文章

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13284826

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档