在 Windows 平台上从 Node.js 连接 DB2 [英] Connecting DB2 from Node.js on Windows-platform

查看:19
本文介绍了在 Windows 平台上从 Node.js 连接 DB2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am currently mirroring the DB2 to local MySQL-db with some jdbc-code. I would like to connect DB2 directly from Node.js app without having to query the mirror. I am running on Windows and I cannot change to Linux. It seems that work on DB2 with Node.js is yet very marginal or node-odbc is used (unixODBC bindings for node).

我发现了这个项目 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 的一部分.

I found this project https://github.com/herzi/db2.js which provides DB2-bindings for Node but I cannot install it as the install fails. The package requires Node-gyp (installed this successfully) and .NET framework SDK. I set the vcbuild.exe into my PATH. After these the msbuild.exe complained about missing header files (sqlcli1.h, sqlsystm.h, sqlca.h), which I found out are part of PRO*C.

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

I took the header files above from here: http://files.edin.dk/php/win32/dev/php_build/include/db2/ and put them into my Node's src/ directory. Now the compiler shows multiple errors.

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

Are there any other options when working with Windows to connect DB2 from Node.js app than try to get the above module to work?

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

Anyone able to help me out here? What are the steps to get the above module installed?

谢谢!

显示的错误:

C:Program FilesMicrosoft SDKsWindowsv7.0Aincludesqlext.h(30): error C2146 : syntax error : missing ';' before identifier 'SQLSTATE' [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

C:Program FilesMicrosoft SDKsWindowsv7.0Aincludesqlext.h(30): error C2146: syntax error : missing ';' before identifier 'SQLSTATE' [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

C:Program FilesMicrosoft SDKsWindowsv7.0Aincludesqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

C:Program FilesMicrosoft SDKsWindowsv7.0Aincludesqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

C:Program FilesMicrosoft SDKsWindowsv7.0Aincludesqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

C:Program FilesMicrosoft SDKsWindowsv7.0Aincludesqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

C:Documents and Settings	paleniu.node-gyp.8.12srcsqlcli1.h(1501): error C2371: 'SQLTCHAR' : redefinition; different basic types [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

C:Program FilesMicrosoft SDKsWindowsv7.0Aincludesqlext.h(30) : see declaration of 'SQLTCHAR'

..srcconnection.cc(77): error C3861: 'snprintf': identifier not found 

[C:IS
ode
ode_modulesdb2uilddb2.vcxproj]..srcconnection.cc(80): error C3861: 'snprintf': identifier not found [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

..srcconnection.cc(111): error C3861: 'bzero': identifier not found [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

..srcconnection.cc(208): error C3861: 'bzero': identifier not found [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

..srcconnection.cc(547): error C2057: expected constant expression [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

..srcconnection.cc(547): error C2466: cannot allocate an array of constant size 0 [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

..srcconnection.cc(547): error C2133: 'argv' : unknown size [C:IS
ode
ode_modulesdb2uilddb2.vcxproj]

推荐答案

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

It is true that node-odbc currently is currently meant only for use with unixODBC. But Daniel VerWeire is currently working on supporting node-odbc on Windows. I guess you need to wait a little while.

Praveen 将在 这里只要有货就可以了

Praveen will have a post on it here as soon as it is available

这篇关于在 Windows 平台上从 Node.js 连接 DB2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆