我目前正在使用一些 jdbc 代码将 DB2 镜像到本地 MySQL-db。我想直接从 Node.js 应用程序连接 DB2,而无需查询镜像。我在 Windows 上运行,无法更改为 Linux。似乎使用 Node.js 在 DB2 上进行工作还很边缘,或者使用了 node-odbc(node 的 unixODBC 绑定)。
我找到了这个项目https://github.com/herzi/db2.js https://github.com/herzi/db2.js它为 Node 提供了 DB2 绑定,但我无法安装它,因为安装失败。该软件包需要 Node-gyp(已成功安装)和 .NET Framework SDK。我将 vcbuild.exe 设置到我的路径中。之后,msbuild.exe 抱怨缺少头文件(sqlcli1.h、sqlsystm.h、sqlca.h),我发现它们是 PRO*C 的一部分。
我从这里获取了上面的头文件:http://files.edin.dk/php/win32/dev/php_build/include/db2/ http://files.edin.dk/php/win32/dev/php_build/include/db2/并将它们放入我的 Node 的 src/ 目录中。现在编译器显示多个错误。
在使用 Windows 从 Node.js 应用程序连接 DB2 时,除了尝试让上述模块工作之外,还有其他选择吗?
有人能帮我吗?安装上述模块的步骤是什么?
Thanks!
显示错误:
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]
确实,node-odbc 目前仅适用于 unixODBC。但丹尼尔·维威尔目前正在研究在 Windows 上支持 node-odbc https://github.com/w1nk/node-odbc/issues/31。我想你需要稍等一下。
Praveen 将对此发表帖子here https://www.ibm.com/developerworks/mydeveloperworks/blogs/pd/entry/using_ibm_db2_from_node_js34?lang=en_us一旦可用
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)