在Windows平台上从Node.js连接DB2(Connecting DB2 from Node.js on Windows

编程入门 行业动态 更新时间:2024-10-24 18:28:43
在Windows平台上从Node.js连接DB2(Connecting DB2 from Node.js on Windows-platform)

我目前正在使用一些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而不是尝试使上述模块工作时,还有其他选择吗?

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

谢谢!

显示的错误:

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]

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]

最满意答案

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

Praveen一旦有空,就会在这里发布一个帖子

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

更多推荐

本文发布于:2023-04-27 22:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329086.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:平台上   Node   Windows   Connecting   js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!