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

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

问题描述

我目前正在使用一些jdbc代码将DB2镜像到本地的MySQL-db。我想直接从Node.js应用程序连接DB2,而不必查询镜像。我在Windows上运行,我不能改变到Linux。看来,使用Node.js的DB2的工作还是非常边缘的,或者使用node-odbc(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从Node.js应用程序连接DB2时是否还有其他选项,而不是尝试使上述模块正常工作? / p>

任何人都可以帮助我在这里?



谢谢!



显示的错误:

  C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30):错误C2146:语法错误:在标识符'SQLSTATE'之前丢失';'[C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

C:\\ \\ Program Files \Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30):错误C2146:语法错误:在标识符SQLSTATE之前缺少';'[C:\IS\ node \\\
ode_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h (30):错误C4430:缺少类型说明符 - int假设。注意:C ++不支持default-int [C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30):错误C4430:缺少类型说明符 - int假设。注意:C ++不支持default-int [C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30):错误C4430:缺少类型说明符 - int假设。注意:C ++不支持default-int [C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30):错误C4430:缺少类型说明符 - int假设。注意:C ++不支持default-int [C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

C:\Documents和Settings\ tpaleniu\.node-gyp\0.8.12\src\sqlcli1.h(1501):错误C2371:'SQLTCHAR':redefinition;不同的基本类型[C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

C:\Program Files\Microsoft SDKs\Windows\ v7.0A\include\sqlext.h(30):看到'SQLTCHAR'的声明

..\src\connection.cc(77):错误C3861:'snprintf':找不到标识符

[C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj] .. \src\connection.cc(80):错误C3861:'snprintf':找不到标识符[C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

..\src\connection。 cc(111):错误C3861:'bzero':未找到标识符[C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

..\\ \\ src\connection.cc(208):错误C3861:'bzero':未找到标识符[C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

..\src\connection.cc(547):错误C2057:预期的常量表达式[C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

..\src\connection.cc(547):错误C2466:无法分配大小为0的数组[C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]

.. \src\connection .cc(547):错误C2133:'argv':未知大小[C:\IS\\\
ode\\\
ode_modules\db2\build\db2.vcxproj]


解决方案

现在,node-odbc目前只适用于unixODBC。但是,Daniel VerWeire正在致力于在Windows上支持node-odbc 。我想你需要等一下。



Praveen将有一个帖子这里一旦可用


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).

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.

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.

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?

Thanks!

Errors shown:

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]

解决方案

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 will have a post on it here as soon as it is available

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

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