简体   繁体   English

在Mac OS X 10.10中,如何使ibm_db for Node.js与DB2一起使用?

[英]How do I get ibm_db for Node.js to work with DB2 in Mac OS X 10.10?

Currently I'm trying to use the ibm_db node.js module to connect my application with DB2 as I did it with Windows (my past workstation's OS). 当前,我正在尝试使用ibm_db node.js模块将应用程序与DB2连接起来,就像我在Windows(过去工作站的操作系统)上所做的那样。 I followed some guides about Mac OS X and ibm_db python module just in case, but it also doesn't work. 我遵循了有关Mac OS X和ibm_db python模块的一些指南 ,以防万一,但是它也不起作用。 ibm_db got to install but when I make the first database interaction it throws an error : ibm_db必须安装,但是当我进行第一次数据库交互时,它将引发错误:

dyld: lazy symbol binding failed: Symbol not found: _SQLAllocHandle
Referenced from: /Users/devniel/dev/Pon.de.tu.parte/node_modules/ibm_db/build/Release/odbc_bindings.node
  Expected in: dynamic lookup

dyld: Symbol not found: _SQLAllocHandle
  Referenced from: /Users/devniel/dev/Pon.de.tu.parte/node_modules/ibm_db/build/Release/odbc_bindings.node
  Expected in: dynamic lookup

I posted an issue on Github, and they explain me that the reason is the lack of a DS Driver for Mac OS X, so, Is there a way to get it works such as the python guys does ? 我在Github上发布了一个问题 ,他们向我解释说,原因是缺少适用于Mac OS X的DS驱动程序,因此, 有没有办法像python一样做到这 一点 (I will try it tomorrow). (明天我会尝试)。

If you have DB2 Express-C installed on your Mac (ie the server), then you already have the client libraries that you need. 如果您的Mac(即服务器)上安装了DB2 Express-C,则您已经具有所需的客户端库。 When you go to build ibm_db , you can point the IBM_DB_HOME environment variable to the DB2 instance owner's sqllib directory. 在构建ibm_db ,可以将IBM_DB_HOME环境变量指向DB2实例所有者的sqllib目录。 For example: 例如:

export IBM_DB_HOME=/Users/db2inst1/sqllib

NOTE: ibm_db will build and work, although the current release has an issue with the bindings.gyp file that prevent it from building on Mac OS X (it is configured to build ONLY on Linux). 注:尽管当前发行版的bindings.gyp文件存在问题,但它无法在Mac OS X上进行构建(已配置为仅在Linux上进行构建),但ibm_db将可以构建和运行。 You can add the following Condition to bindings.gyp to get it to build with node-gyp : 您可以将以下条件添加到bindings.gyp中,以便使用node-gyp构建它:

    [ 'OS == "mac" and target_arch =="x64" ', {
      'libraries' : [
        '-L$(IBM_DB_HOME)/lib -L$(IBM_DB_HOME)/lib64 ',
        '-ldb2'
      ],
      'include_dirs': [
        '$(IBM_DB_HOME)/include'
      ],
      'cflags' : [
        "-g "
      ],
    }]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM