在Windows平台上使用Node.js连接DB2

4
我目前在使用一些JDBC代码将DB2镜像到本地MySQL数据库。我想在不查询镜像的情况下直接从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/ 获取了上述头文件,并将它们放入我的Node的src/目录中。现在编译器显示多个错误。

除了尝试使上述模块正常工作,使用Windows连接DB2的Node.js应用程序是否有其他选项?

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

谢谢!

显示的错误:

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]
1个回答

1

确实,node-odbc目前仅适用于unixODBC。但是Daniel VerWeire目前正在努力支持Windows上的node-odbc。我想你需要等一段时间。

一旦可用,Praveen将在此处发布相关文章。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接