3

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

我找到了这个项目https://github.com/herzi/db2.js,它为 Node 提供了 DB2 绑定,但由于安装失败,我无法安装它。该软件包需要 Node-gyp(已成功安装)和 .NET 框架 SDK。我将 vcbuild.exe 设置到我的 PATH 中。在这些之后,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 时,除了尝试让上述模块工作之外,还有其他选择吗?

任何人都可以在这里帮助我吗?安装上述模块的步骤是什么?

谢谢!

显示的错误:

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]
4

1 回答 1

1

确实,node-odbc 当前仅适用于 unixODBC。但 Daniel VerWeire 目前正致力于在 Windows 上支持 node-odbc。我想你需要等一会儿。

Praveen 一有空就会在这里发帖

于 2012-12-10T09:27:47.603 回答